Riemann Sums for exponential functions I had a question about Riemann Sums for exponential functions. Function in question is:
$e^{-x^2}$ [More commonly known as the Gaussian Integral.] 
The integral from from 0 to 1 (definite integral with the upper limit 1 and the lower limit 0)
Using Riemann Sums, I managed to solve for a specific amount of rectangles. (e.g 5,7,9 etc). However, I wanted to solve for "n" rectangles. 
How exactly would I go about doing this? I looked at a couple videos and none of them talk about exponential functions; only polynomials. I know I have to express it as a limit as n goes to infinity but I'm having trouble with it. 
I know that $\Delta x$ would be $1/n$. However, I'm having trouble with the rest.
Any help would be appreciated. 
 A: It does not matter what the function is. The general formula are
$$
I \approx \frac{1}{n}\sum_{k=0}^{n-1} f\left(\frac{1}{k}\right)$$
using the left side of rectangles.
$$
I \approx \frac{1}{n}\sum_{k=1}^{n} f\left(\frac{1}{k}\right)$$
using the right side of rectangles.
You can average the two to get Trapezoidal integration.
For your problem
$$
f\left(\frac{1}{k}\right) = e^{\frac{-1}{k^2}}
$$
Added in response to OP's question
Here are calculations for $N=4$
$$
\frac{ e^{-(1/4)^2}+ e^{-(2/4)^2}+ e^{-(3/4)^2}+ e^{-(4/4)^2}}{4}
\\
\frac{ 0.9394+ 0.7788+ 0.5698+ 0.3679}{4}
= 0.664$$
For $N=6$
$$\frac{ e^{-(1/6)^2}+ e^{-(2/6)^2}+ e^{-(3/6)^2}+ e^{-(4/6)^2}+ e^{-(5/6)^2}+ e^
{-(6/6)^2}}{6}\\
\frac{0.972604+ 0.894839+ 0.778801+ 0.64118+ 0.499352+ 0.367879}{6}
= 0.692443
$$
For $N=8$:
$$
\frac{e^{-(1/8)^2}+ e^{-(2/8)^2}+ e^{-(3/8)^2}+ e^{-(4/8)^2}+ e^{-(5/8)^2}+ e^
{-(6/8)^2}+ e^{-(7/8)^2}+ e^{-(8/8)^2}}{8}
\\
=\frac{0.9845+ 0.9394+ 0.8688+ 0.7788+ 0.6766+ 0.5698+ 0.465+ 0.3679}{8}
= 0.7064
$$
If you look carefully, half the numbers for $N=8$ are already calculated for $N=4$. So if you double $N$, you can save half the calculations.
If you know Richardson Extrapolation, you can estimate the limit $N\rightarrow \infty$ easily.
