[Question]
  [
You are to approximate the value of:
$$\int^I\_0 \frac {e^x} {x^x} dx$$
Where your input is \$I\$.
# Rules
* You may not use any built-in integral functions.
* You may not use any built-in infinite summation functions.
* Your code must execute in a reasonable amount of time ( < 20 seconds on my machine)
* You may assume that input is greater than 0 but less than your language's upper limit.
* It may be any form of standard return/output.
You can verify your results at [Wolfram | Alpha](http://www.wolframalpha.com/input/?i=integrate+e%5Ex%2Fx%5Ex+from+0+to) (you can verify by concatenating your intended input to the linked query).
# Examples
(let's call the function `f`)
```
f(1) -> 2.18273
f(50) -> 6.39981
f(10000) -> 6.39981
f(2.71828) -> 5.58040
f(3.14159) -> 5.92228
```
Your answer should be accurate to `±.0001`.
  
[Answer]
# Julia, ~~79~~ ~~77~~ 38 bytes
```
I->sum(x->(e/x)^x,0:1e-5:min(I,9))/1e5
```
This is an anonymous function that accepts a numeric value and returns a float. To call it, assign it to a variable.
The approach here is to use a right Riemann sum to approximate the integral, which is given by the following formula:
$$\int\_a^b f(x) dx \approx \sum f(x) \Delta x$$
In our case, \$a = 0\$ and \$b = I\$, the input. We divide the region of integration into \$n = 10^5\$ discrete portions, so \$∆x = \frac 1 n = 10^{-5}\$. Since this is a constant relative to the sum, we can pull this outside of the sum and simply sum the function evaluations at each point and divide by \$n\$.
The function is surprisingly well-behaved (plot from Mathematica):
[![mathematicaplot](https://i.stack.imgur.com/RLKPH.png)](https://i.stack.imgur.com/RLKPH.png)
Since the function evaluates nearly to 0 for inputs greater than about 9, we truncate the input to be \$I\$ if \$I\$ is less than 9, or 9 otherwise. This simplifies the calculations we have to do significantly.
Ungolfed code:
```
function g(I)
    # Define the range over which to sum. We truncate the input
    # at 9 and subdivide the region into 1e5 pieces.
    range = 0:1e-5:min(I,9)
    # Evaluate the function at each of the 1e5 points, sum the
    # results, and divide by the number of points.
    return sum(x -> (e / x)^x, range) / 1e5
end
```
Saved 39 bytes thanks to Dennis!
[Answer]
# Jelly, ~~20~~ ~~19~~ 17 bytes
```
ð«9×R÷øȷ5µØe÷*×ḢS
```
This borrows the clever *truncate at 9* trick from [@AlexA.'s answer](https://codegolf.stackexchange.com/a/71314), and uses a [right Riemann sum](https://en.wikipedia.org/wiki/Riemann_sum#Right_Riemann_Sum) to estimate the corresponding integral.
Truncated test cases take a while, but are fast enough on [Try it online!](http://jelly.tryitonline.net/#code=w7DCqznDl1LDt8O4yLc1wrXDmGXDtyrDl-G4olM&input=&args=MTA&debug=on)
### How it works
```
ð«9×R÷øȷ5µØe÷*×ḢS  Main link. Input: I
      øȷ5          Niladic chain. Yields 1e5 = 100,000.
ð                  Dyadic chain. Left argument: I. Right argument: 1e5.
 «9                Compute min(I, 9).
   ×               Multiply the minimum with 1e5.
    R              Range; yield [1, 2, ..., min(I, 9) * 1e5] or [0] if I < 1e-5.
     ÷             Divide the range's items by 1e5.
                   This yields r := [1e-5, 2e-5, ... min(I, 9)] or [0] if I < 1e-5.
         µ         Monadic chain. Argument: r
          Øe÷      Divide e by each element of r.
             *     Elevate the resulting quotients to the corresponding elements,
                   mapping t -> (e/t) ** t over r.
                   For the special case of r = [0], this yields [1], since
                   (e/0) ** 0 = inf ** 0 = 1 in Jelly.
              ×Ḣ   Multiply each power by the first element of r, i.e., 1e-5 or 0.
                S  Add the resulting products.
```
[Answer]
## ES7, 78 bytes
```
i=>[...Array(n=2e3)].reduce(r=>r+Math.exp(j+=i)/j**j,0,i>9?i=9:0,i/=n,j=-i/2)*i
```
This uses the rectangle rule with 2000 rectangles, which (at least for the examples) seem to produce a sufficiently accurate answer, but the accuracy could easily be increased if necessary. It has to use the 9 trick otherwise the accuracy drops off for large values.
73 byte version that uses rectangles of width ~0.001 so it doesn't work above ~700 because Math.exp hits Infinity:
```
i=>[...Array(n=i*1e3|0)].reduce(r=>r+Math.exp(j+=i)/j**j,0,i/=n,j=-i/2)*i
```
[Answer]
# [MATL](https://esolangs.org/wiki/MATL), 26 bytes
```
9hX<t1e6XK:K/*ttZebb^/sK/*
```
This approximates the integral as a Riemann sum. As argued by Alex, we can truncate the integration interval at approximately 9 because the function values are very small beyond that.
The maximum value of the function is less than 3, so a step of about 1e-5 should be enough to obtain the desired accuracy. So for the maximum input 9 we need about 1e6 points.
This takes about 1.5 seconds in the online compiler, for any input value.
[**Try it online**!](http://matl.tryitonline.net/#code=OWhYPHQxZTZYSzpLLyp0dFplYmJeL3NLLyo&input=My4xNDE1OQ)
```
9hX<         % input number, and limit to 9
t            % duplicate
1e6XK:       % generate vector [1,2,...,1e6]. Copy 1e6 to clipboard K
K/*          % divide by 1e6 and multiply by truncated input. This gives 
             % a vector with 1e6 values of x from 0 to truncated input
ttZe         % duplicate twice. Compute exp(x)
bb^          % rotate top three elements of stack twice. Compute x^x
/            % divide to compute exp(x)/x^x
s            % sum function values
K/*          % multiply by the step, which is the truncated input divided
             % by 1e6
```
[Answer]
# [golflua](http://mniip.com/misc/conv/golflua/), 83 chars
I'll admit it: it took my a while to figure out the `min(I,9)` trick Alex presented allowed computing arbitrarily high numbers because the integral converged by then.
```
\f(x)~M.e(x)/x^x$b=M.mn(I.r(),9)n=1e6t=b/n g=0.5+f(b/2)~@k=1,n-1g=g+f(k*t)$I.w(t*g)
```
An ungolfed Lua equivalent would be
```
function f(x)
   return math.exp(x)/x^x
end
b=math.min(io.read("*n"),9)
n=1e6
t=b/n
g=0.5+f(b/2)
for k=1,n-1 do
   g=g+f(k*t)
end
io.write(t*g)
```
[Answer]
# Python 2, ~~94~~ 76 bytes
Thanks to @Dennis for saving me 18 bytes!
```
lambda I,x=1e5:sum((2.71828/i*x)**(i/x)/x for i in range(1,int(min(I,9)*x)))
```
[Try it online with testcases!](https://repl.it/Bk6w/2)
Using the rectangle method for the approximation. Using a rectangle width of 0.0001 which gives me the demanded precision. Also truncating inputs greater 9 to prevent memory errors with very big inputs.
[Answer]
# Perl 6, ~~90~~ 55 bytes
```
{my \x=1e5;sum ((e/$_*x)**($_/x)/x for 1..min($_,9)*x)}
```
**usage**
```
my &f = {my \x=1e5;sum ((e/$_*x)**($_/x)/x for 1..min($_,9)*x)}
f(1).say;       # 2.1827350239231
f(50).say;      # 6.39979602775846
f(10000).say;   # 6.39979602775846
f(2.71828).say; # 5.58039854392816
f(3.14159).say; # 5.92227602782184
```
It's late and I need to sleep, I'll see if I can get this any shorter tomorrow.
EDIT: Managed to get it quite a bit shorter after seeing @DenkerAffe 's method.
[Answer]
# Pyth, ~~34~~ 29 bytes
Saved 5 Bytes with some help from @Dennis!
```
J^T5smcc^.n1d^ddJmcdJU*hS,Q9J
```
[Try it online!](http://pyth.herokuapp.com/?code=J%5ET5smcc%5E.n1d%5EddJmcdJU*hS%2CQ9J&input=1&test_suite_input=1%0A50%0A10000%0A2.71828%0A3.14159&debug=0)
### Explanation
Same algorithm as in [my Python answer](https://codegolf.stackexchange.com/a/71346/49110).
```
J^T5smcc^.n1d^ddJmcdJU*hS,Q9J        # Q=input
J^T5                                 # set J so rectangle width *10^5
                       hS,Q9         # truncate inputs greater 9
                 mcdJU/     J        # range from zero to Input in J steps
     mcc^.n1d^ddJ                    # calculate area for each element in the list
    s                                # Sum all areas and output result
                    
```
[Answer]
# Vitsy, 39 bytes
Thought I might as well give my own contribution. ¯\\_(ツ)\_/¯ This uses the Left-Hand Riemann Sum estimation of integrals.
```
D9/([X9]1a5^D{/V}*0v1{\[EvV+DDv{/}^+]V*
D9/([X9]               Truncation trick from Alex A.'s answer.
D                      Duplicate input.
 9/                    Divide it by 9.
   ([  ]               If the result is greater than 0
     X9                Remove the top item of the stack, and push 9.
1a5^D{/V}*0v0{         Setting up for the summation.
1                      Push 1.
 a5^                   Push 100000.
    D                  Duplicate the top item of the stack.
     {                 Push the top item of the stack to the back.
      /                Divide the top two items of the stack. (1/100000)
       V               Save it as a global variable.
                       Our global variable is ∆x.
        }              Push the bottom item of the stack to the top.
         *             Multiply the top two items.
                       input*100000 is now on the stack.
          0v           Save 0 as a temporary variable.
            0          Push 1.
             {         Push the bottom item of the stack to the top.
                       input*100000 is now the top of the stack.
\[EvV+DDv{/}^+]        Summation.
\[            ]        Loop over this top item of the stack times.
                       input*100000 times, to be exact.
  E                    Push Math.E to the stack.
   v                   Push the temporary variable to the stack.
                       This is the current value of x.
    V+                 Add ∆x.
      DD               Duplicate twice.
        v              Save the temporary variable again.
         {             Push the top item of the stack to the back.
          /            Divide the top two items.
                       e/x
           }           Push the top item back to the top of the stack.
            ^          Put the second to top item of the stack to the power of the top item.
                       (e/x)^x
             +         Add that to the current sum.
V*                     Multiply by ∆x
```
This leaves the sum on the top of the stack. The try it online link below has `N` on the end to show you the result.
[Try it Online!](http://vitsy.tryitonline.net/#code=RDkvKFtYOV0xYTVeRHsvVn0qMHYwe1xbRXZWK0REdnsvfV4rXVYqTg&input=&args=OQ)
]