How to compute $\lim\limits_{h\to0^+}{h\sum_{n=1}^\infty\operatorname{\mathit{f}}(nh)}$ as an improper integral Let  $f(x)=\frac {\ln(x)}{1+x^2}$, how to compute $\lim\limits_{h\to0^+}{h\sum_{n=1}^\infty\operatorname{\mathit{f}}(nh)}$ as an improper integral ?
We know if  $f$ is  monotone on $[0,+\infty[$ and the improper integral $\int_0^{+\infty}{\operatorname{\mathit{f}}(x)\operatorname*{d}x}$ exists, then  $$\lim\limits_{h\to0^+}{h\sum_{n=1}^\infty\operatorname{\mathit{f}}(nh)}=\int_0^{+\infty}{\operatorname{\mathit{f}}(x)\operatorname*{d} x}$$
But our $f$ is not monotone on all $[0,+\infty[$, ( $f$ is increasing on $]0,\sqrt e]$ and decreasing on $[\sqrt e,+\infty[$)
 A: Let
$$g_1(x)=\begin{cases} f(\sqrt e), & 0<x\leq \sqrt e\\ f(x), & x>\sqrt e\end{cases}$$
and
$$g_2(x)=\begin{cases} f(x)-f(\sqrt e), & 0<x\leq \sqrt e\\ 0, & x>\sqrt e\end{cases}$$
then $f=g_1+g_2$ and both of $g_1, g_2$ are monotone. Also, the improper integrals $\int_0^\infty g_1(x)\,dx$ and $\int_0^\infty g_2(x)\,dx$ both exist. Hence
$$\lim_{h\to0^+}h\sum_{n=1}^\infty g_1(nh)=\int_0^\infty g_1(x)\,dx,\qquad \lim_{h\to0^+}h\sum_{n=1}^\infty g_2(nh)=\int_0^\infty g_2(x)\,dx.$$
The result for monotone functions is proved in this post and here we apply the result from that post to $-g_2$.
Therefore,
\begin{align*}
\lim_{h\to0^+}h\sum_{n=1}^\infty f(nh)&=\lim_{h\to0^+}h\sum_{n=1}^\infty g_1(nh)+\lim_{h\to0^+}h\sum_{n=1}^\infty g_2(nh)\\
&=\int_0^\infty g_1(x)\,dx+\int_0^\infty g_2(x)\,dx\\
&=\int_0^\infty f(x)\,dx.
\end{align*}
A: Write $f = f_1 + f_2$, where
$$ \begin{align*}
f_1(x) &= \begin{cases}
\frac{\ln(x)}{1+x^2} - \frac{1}{2(1+e)} & x \leq \sqrt{e} \\
0 & x > \sqrt{e}
\end{cases} \\
f_2(x) &= \begin{cases}
\frac{1}{2(1+e)} & x \leq \sqrt{e} \\
\frac{\ln(x)}{1+x^2} & x > \sqrt{e}
\end{cases}
\end{align*} $$
Notice $f_1$ is non-decreasing and $f_2$ is non-increasing.
For any given $h>0$,
$$ \sum_{n=1}^\infty f(nh) = \sum_{n=1}^\infty f_1(nh) + \sum_{n=1}^\infty f_2(nh) $$
if both sums on the right side converge absolutely. The $f_1$ sum converges absolutely since all but a finite number of terms are zero. The $f_2$ sum converges absolutely since $0 < f_2(nh) < (nh)^{-3/2}$ when $n$ is sufficiently large.
$$ \lim_{h \to 0^+} h \sum_{n=1}^\infty f(nh) = \lim_{h \to 0^+} h \left[ \sum_{n=1}^\infty f_1(nh) + \sum_{n=1}^\infty f_2(nh)\right] = \lim_{h \to 0^+} h \sum_{n=1}^\infty f_1(nh) + \lim_{h \to 0^+} h \sum_{n=1}^\infty f_2(nh) $$
where the second equality holds if both limits on the right side exist. At this point you can use the theorem you quoted.
More generally, this method will show the result is also true whenever $f$ can be split into a finite number of monotone pieces where the integral of each piece converges absolutely. (Or a countable number of pieces, if the final sum of countably many limits also converges absolutely.)
A: Can't you apply your theorem to compute $\int_0^{\sqrt e}(f(x)-f(\sqrt e))\,\mathrm dx$ and $\int_0^\infty f(x+\sqrt e)\,\mathrm dx$?
