Turning infinite sum into integral
Could someone explain how one can replace infinite sum with integral?
Examples (or you may use your own, it doesn't matter as I want to understand principles):
$$\frac{1}{n} \sum_{i=1}^{n} \sin \frac{i-1}{n} \pi$$
$$\frac{1}{n} \sum_{i=1}^{n} \sqrt{1 + \frac{i}{n}}$$
I see that $\frac{1}{n}$ denote partition, so my problem is that I don't know how to figure out the function, hence, the integrand.
The Left-hand Rectangular Approximation Method (LRAM) says that, if $f(x)$ is continuous on $[a,b]$,
$$\int_a^b f(x)\,dx=\lim_{n\to\infty}\frac {b-a}{n}\sum_{i=1}^n f\left(a+\frac{b-a}n (i-1) \right)$$
Comparing that with your first sum, we see that $\ a=0,\ b=\pi, f(x)=\sin x/\pi$. So, the limit of your sum as $n\to\infty$ is
$$\frac{1}{\pi}\int_0^{\pi} \sin x\,dx$$
Note that this is not your sum, as you asked, not even an infinite sum, but a limit of sums.
The Right-hand Rectangular Approximation Method (RRAM) says that, if $f(x)$ is continuous on $[a,b]$,
$$\int_a^b f(x)\,dx=\lim_{n\to\infty}\frac {b-a}{n}\sum_{i=1}^n f\left(a+\frac{b-a}n i \right)$$
Comparing that with your second sum, we see that $f(x)=\sqrt x,\ a=1,\ b=2$. So the limit of your sum as $n\to\infty$ is
$$\int_1^2 \sqrt x\,dx$$
Note: The main difference in these two methods is that LRAM has the term $f(a)$ but not the term $f(b)$ while RRAM has the term $f(b)$ but not the term $f(a)$ in the sum. This is due to the different indices on the sum.
The basic idea is this:
If $f$ is a positive increasing function then $f(n) \le \int_n^{n+1} f(x) dx \le f(n+1) $.
Similarly, if $f$ is a positive decreasing function then $f(n) \ge \int_n^{n+1} f(x) dx \ge f(n+1) $.
For increasing $f$, $\sum_{i=0}^{n-1} f(i) \le \int_0^{n} f(x) dx \le \sum_{i=0}^{n-1} f(i+1) $ or $\sum_{i=0}^{n} f(i)-f(n) \le \int_0^{n} f(x) dx \le \sum_{i=0}^{n} f(i)-f(0) $ or $f(0) \le \sum_{i=0}^{n} f(i)-\int_0^{n} f(x) dx \le f(n) $.
For a decreasing function, the inequalities are reversed.
From this you can show that for a bounded piecewise monotonic function, the sum converges to the integral.