How evaluate $\int \frac{\cos^2(x)}{1 + \text{e}^x}dx$ to find an improper integral Can someone help me evaluate this:
$$\int \frac{\cos^2(x)}{1 + \text{e}^x}dx\;?$$
I need it for determining whether the improper integral $\int_0^\infty  {\frac{{\cos^2{{(x)}}}}{{1 + {{\text{e}}^x}}}}$ is convergent or not.
Using the software Maple is not possible to determine symbolically, but it is possible to evaluate it numerically:
$$\int_0^\infty  {\frac{{\cos^2{{(x)}}}}{{1 + {{\text{e}}^x}}}}=0.3831765832$$
So apparently it converges, but how would show whether such an integral converges or diverges?
Using Wolfram Alpha I get symbolic result in terms of hypergeometric functions, but I want to know if it is possible to calculate in terms of elementary functions.
 A: The given integral has a positive integrand less than $$\frac{1}{(1+x^2)}$$ whose integral from $0$ to $\infty$ is $\frac{\pi}{2}$ so it converges. But to evaluate the integral is a different story.
A: Since
$$\mathcal{L}\left(\cos^2 x\right)=\frac{s^2+2}{s(s^2+4)}\tag{1}$$
and:
$$\int_{0}^{+\infty}\frac{\cos^2 x}{1+x^2}\,dx = \sum_{n\geq 1}(-1)^{n+1}\int_{0}^{+\infty}\cos^2(x)\,e^{-nx}\,dx \tag{2}$$
we have:
$$\int_{0}^{+\infty}\frac{\cos^2 x}{1+x^2}\,dx = \sum_{n\geq 1}(-1)^{n+1}\frac{2+n^2}{n^3+4n}=\frac{\log 2}{2}+\frac{1}{2}\sum_{n\geq 1}(-1)^{n+1}\frac{n}{n^2+4}.\tag{3}$$
The last series can be evaluated in terms of values of the digamma function: $$\psi(x)=\frac{d}{dx}\log\Gamma(x).$$
A: A nondecreasing, bounded function always converges. So let $f(x) = \frac{\cos^2x}{1+e^x}$. Clearly $f(x) > 0\, \forall x$, so $\int_0^t f(x) dx$ is nondecreasing in $t$. We need to show it's bounded. $\int _0^t f(x)dx < \int_0^\infty \frac{dx}{1+e^x} < \int_0^\infty \frac{dx}{e^x} = 1$. Done.
It's unlikely to be expressible as an elementary function. This can be determined using Risch's algorithm.
