Find $f$ so that $\int_{1}^{\infty}f(x)dx$ exists, but $\displaystyle \lim_{x\to\infty}f(x)$ does not exist? I need help finding an example of a function such that $\int_{1}^{\infty}f(x)dx$ converges, but $\displaystyle \lim_{x\to\infty}f(x)$ does not exist.  
I was trying to find examples of functions containing some trigonometric function and/or some exponential function, but all the functions I've managed to think of whose improper integral converges also have a well defined limit as $x$ goes to infinity.
I'd appreciate any ideas and hints you might have!
 A: For an explicit formula, with a nice (?) continuous function, we can use for example $f(x)=\sin(x^2)$. To see that it works, we calculate
$$I_M=\int_1^M \sin(x^2)\,dx,$$
and show that $\lim_{M\to\infty} I_M$ exists.
Do the integration using integration by parts, letting $u=\frac{1}{x}$ and $dv=x\sin(x^2)\,dx$. Then $du=-\frac{1}{x^2}\,dx$ and we can take $u=-\frac{1}{2}\cos(x^2)$. 
The integral $\int_0^M \frac{\cos x^2}{2x^2}\,dx$ that remains to be looked at has a limit as $M\to\infty$, for the integrand has absolute value $\le \frac{1}{2x^2}$.
A: $\int_1^{\infty}\cos(x^2) dx $ exists but obviously $\lim_{x \to \infty}\cos (x^2)$ does not exist.

Altought not requested in the original post, it is instructive to note that $\int_0^{\infty}\cos(x^2) dx =\frac12 \sqrt{\frac{\pi}{2}}$.  This can be easily verified by using contour integration and applying Cauchy's Integral Theorem.  
Let $C$ be the contour that consists of $C_1$ along the real axis from $0$ to $R$, $C_2$, the portion of the circle $|z|=R$ that starts at $(R,0)$ and ends at $(r/\sqrt{2},r/\sqrt{2})$, and $C_3$ the line segment that starts at $(r/\sqrt{2},r/\sqrt{2})$ and ends at the origin.  Then, Cauchy's Integral Theorem reveals that
$$\oint_C\,e^{-z^2}\,dz=\int_0^R e^{-x^2}dx+\int_0^{\pi/4}e^{-R^2e^{i2\theta}}Re^{i\theta}d\theta-\int_0^R e^{(1+i)^2t^2}(1+i)dt=0$$
The middle integral is easily seen to vanish as $R \to \infty$.  Now, simplifying and using $\int_0^{\infty}e^{-x^2}dx=\sqrt{\pi}/2$, we find
$$\int_0^{\infty}e^{-it^2}dt=\frac{\sqrt{\pi}}{2}e^{-i\pi/4}.$$
Finally, equating real and imaginary parts yields
$$\int_0^{\infty}\cos(t^2)dt=\frac12 \sqrt{\frac{\pi}{2}}$$
and
$$\int_0^{\infty}\sin(t^2)dt=\frac12 \sqrt{\frac{\pi}{2}}$$
