"Natural" continuous/smooth non-negative functions $f$ that are unbounded at $\infty$ with finite integral $\int_0^\infty f dx$ It's easy to draw pictures or define piece-wise non-negative functions $f(x)$ that are continuous and unbounded as $x \to \infty$ but have finite indefinite integral $\int_0^\infty f(x) dx$. What are some continuous examples in terms of elementary functions? I was thinking something like $f(x) = x | \cos x|^{x^k}$ might work for some $k \geq 1$ or maybe $f(x) = x | \cos x|^{e^x}$ but I'm having a hard time proving it.
 A: You can find a family of examples here, one is $f(x)=x^2 \exp(-x^8\sin^2 x)$.
A: Let's put it another way. Start with an antiderivative. It shall converge, yet have an unbounded derivative. For example, $F = \frac{\sin{x^3}}{x}$ may serve as such. Then the function you are looking for is $f = F' = \frac{3x^3cos{x^3} - sin{x^3}}{x^2} \approx 3x$ as $x \to \infty$
A: I have an essentially rigorous proof that $f(x) = x |\cos x|^{x e^x}$ works. We can analyze an interval $[(k-1) \pi/2, k \pi/2]$ for positive integer $k$ as follows. Essentially we show that $x| \cos x|^{x e^x}$ is only somewhat large on a very small interval around the endpoint that is a multiple of $\pi$. Then the integral over the interval is a sum of two parts: A very small interval where the function is not small, and the rest of the interval where the function is very small. The two contributions for the interval add up to an exponentially small quantity, so that the integral is finite when summed over all intervals. 
So for a given interval $[(k-1) \pi/2, k \pi/2]$, let $x_0$ be the value of the endpoint that is a multiple of $\pi$. Then for $x = x_0 +\epsilon$ where $|\epsilon|$ is small, we have $|\cos x| \leq 1 - \epsilon^2/3$. Putting $\epsilon = e^{-x_0/2}$, we get $x| \cos x|^{x e^x}| \leq x((1-e^{-x_0}/3)^{3e^{x}})^{x/3} \simeq x e^{-x/3}$ when $x$ is large. So on a small subinterval near $x_0$, of width $e^{-x_0/2}$, we get that the integral is bounded by approximately $x_0 e^{-x_0/2}$ (bounding $|\cos x|$  by $1$), and on the remainder of the interval $[(k-1) \pi/2, k \pi/2]$ we get that the function is bounded by approximately $x_0 e^{-x_0/3}$ when $x_0$ is large so the integral is bounded by approximately $\pi x_0 e^{-x_0/3}/2$. Thus when $x_0$ is large the integral over the entire interval is bounded by approximately $x_0 e^{-x_0/2} + \pi x_0 e^{-x_0/3}/2$. Summing over all intervals gives a convergent sum, so the indefinite integral $\int_0^{\infty} f(x) dx$ is finite.
