Convergence $\int_1^{\infty} x^2 \cos(e^x)\,dx$ I am learning about ways to test if an integral converges or diverges and I am stuck with this one:$$\int_1^{+\infty}x^2\cos(e^x)dx=?$$
UPD: I forgot to say that I had to explore absolute and conditional convergence.
 A: The integral converges, but only conditionally. Introduce a factor to make IBP work out:
$$
I=\int _1^{\infty} x^2\cos(e^x)\,dx = \int _1^{\infty}\underbrace{x^2 e^{-x}}_u\cdot \underbrace{\cos(e^x)e^x\,dx }_{dv}
$$
$$
=\left.x^2 e^{-x} \sin(e^x)\right|_1^{\infty} +\int _1^{\infty}e^{-x}\sin(e^x)(x^2-2x)\,dx
$$
$$
=-\frac{\sin(e)}{e}+\int _1^{\infty}e^{-x}\sin(e^x)(x^2-2x)\,dx
$$For the last integral, by some very crude bounds we have
$$
\left|\int _1^{\infty}e^{-x}\sin(e^x)(x^2-2x)\,dx\right|\leq \int _1^{\infty}\left|e^{-x}\sin(e^x)(x^2-2x)\right|\,dx
$$
$$
\leq \int _1^{\infty}\left|e^{-x}(x^2-2x)\right|\,dx \leq \int _0^{\infty}\left|e^{-x}(x^2-2x)\right|\,dx
$$
$$
\leq \int _0^{\infty}e^{-x}(x^2+2x)\,dx =4;
$$Mathematica gives $0.0584793$ as a much more accurate estimate of the integral. To show that convergence is conditional, put absolute values, write the integral as an infinite series, and use the Mean Value Theorem in each subinterval:
$$
\int_1^{\infty} |x^2\cos(e^x)|\,dx>\int_{\log(3\pi/2)}^{\infty} x^2|\cos(e^x)|\,dx
$$
$$
= \sum _{k=1}^{\infty} \int_{\log((2k+1)\frac{\pi}{2})}^{\log((2k+3)\frac{\pi}{2})} x^2|\cos(e^x)|\,dx
$$
$$
> \sum _{k=1}^{\infty} \left(\log((2k+1)\frac{\pi}{2})\right)^2 \cdot \int_{\log((2k+1)\frac{\pi}{2})}^{\log((2k+3)\frac{\pi}{2})} |\cos(e^x)|\,dx
$$The integrand is concave, so we can underapproximate the integral by the triangle with vertices $\{(\log((2k+1)\frac{\pi}{2}),0),(\log((k+1)\pi),1),(\log((2k+3)\frac{\pi}{2}),0)\}$:
$$
> \cdot \sum _{k=1}^{\infty} (\log((2k+1)\frac{\pi}{2}))^2\cdot \frac{1}{2} \left(\log((2k+3)\frac{\pi}{2})-\log((2k+1)\frac{\pi}{2})\right)
$$Finally, this series diverges (one could use, for example, Ermakoff's Test, a variant of the Cauchy Condensation Test).
A: Substitute $u = e^x$. Then
$$ \int_{1}^{R} x^2 \cos(e^x) \, \mathrm{d}x
= \int_{e}^{e^R} \frac{\log^2 u}{u} \cos u \, \mathrm{d}u. $$
Since $u \mapsto \frac{\log^2 u}{u}$ is decreasing for $u \geq e^2$ and vanishes as $u\to\infty$, the integral converges as $R\to\infty$ by the alternating series test. On the other hand, using the fact that $e^2 \leq 2.75\pi$,
\begin{align*}
\int_{1}^{\infty} \left| x^2 \cos(e^x) \right| \, \mathrm{d}x
&= \int_{e}^{\infty} \left| \frac{\log^2 u}{u} \cos u \right| \, \mathrm{d}u \\
&\geq \sum_{n=3}^{\infty} \int_{n\pi-\frac{\pi}{4}}^{n\pi} \left| \frac{\log^2 u}{u} \cos u \right| \, \mathrm{d}u \\
&\geq \frac{\pi}{4}\sin\left(\frac{\pi}{4}\right) \sum_{n=3}^{\infty} \frac{\log^2 (n\pi)}{\pi n} \\
&= \infty.
\end{align*}
