TITLE: If $\int_0^\infty f\text{d}x$ exists, does $\lim_{x\to\infty}f(x)=0$?
QUESTION [7 upvotes]: Are there examples of functions $f$ such that $\int_0^\infty f\text{d}x$ exists, but $\lim_{x\to\infty}f(x)\neq 0$?
I curious because I know for infinite series, if $a_n\not\to 0$, then $\sum a_n$ diverges. I'm wondering if there is something similar for improper integrals.

REPLY [4 votes]: Here is one more example:
$$
f(x)=x\sin (x^4)
$$
This is infinitely differentiable unbounded function without limit at infinity but with the finite improper Riemann integral over $\mathbb{R}_+$:
$$
\int_0^{+\infty}x\sin(x^4)dx=\{t=x^4\}=\frac{1}{4}\int_0^{+\infty}\frac{\sin t}{\sqrt{t}} dt=\frac{1}{4}\sqrt{\frac{\pi}{2}}
$$