TITLE: Riemann sum on infinite interval
QUESTION [12 upvotes]: It is well known that in the case of a finite interval $[0,1]$ with a partition of equal size $1/n$, we have:
$$\lim_{n\rightarrow \infty} \frac{1}{n}\sum_{k=0}^{n-1} f\left(\frac{k}{n}\right)=\int_0^1 f(x)dx$$
I was wondering under which conditions on $f$ this could be extended to the case of the positive real line, i.e which conditions on $f$ would enable us to be able to rigorously write:
$$\lim_{n\rightarrow \infty} \frac{1}{n}\sum_{k\geq0} f\left(\frac{k}{n}\right)=\int_0^{\infty} f(x)dx$$
Any ideas or references to literature would be greatly appreciated.

REPLY [4 votes]: For some $x\in[a,b]$, we have
$$
\int_a^b f(x)\,\mathrm{d}x-f(a)(b-a)=f'(x)(b-a)^2
$$
Therefore,
$$
\lim_{n\to\infty}n\left|\,\sum_{k=0}^\infty f\left(\frac kn\right)\frac1n-\int_0^\infty f(x)\,\mathrm{d}x\,\right|
\lesssim\int_0^\infty\left|\,f'(x)\,\right|\,\mathrm{d}x
$$
This says that if the variation of a function is finite, then the Riemann sums converge to the integral.  This makes sense, because any function of bounded variation can be written as the difference of two monotonic decreasing functions.