TITLE: Improper integrals: is it possible to have a non bounded function such that its improper integral converges?
QUESTION [5 upvotes]: Find an example of a non-negative function $(f\geq 0)$ which is continuous and such that $\int_{0}^{\infty}f(x)dx$ is finite ($\int f < \infty$) but $\lim_{x\rightarrow\infty}f(x)$ does not exist. 
Also, is it possible that $\int_{0}^{\infty}f(x)\,dx$ exist but $f(x)$ is not bounded?

REPLY [2 votes]: $$ f(x) = \sum_{n\geq 1} n e^{-n^6(x-n)^2} $$
is a continuous and non-negative function, which is unbounded over $\mathbb{R}^+$ (since $f(n)\geq n$) and such that
$$ \int_{\mathbb{R}^+}f(x)\,dx \leq \int_{\mathbb{R}}f(x)\,dx = \sum_{n\geq 1}\frac{\sqrt{\pi}}{n^2} = \frac{\pi^{5/2}}{6} < +\infty. $$
$\hspace1in$