Analyze a function defined in terms of an integral Here is a question that really has puzzled me for quite a while. I happened to see this function defined in terms of an integral 
$$f(x):=\int_0^{\pi/2}\frac{2e^{x+e^x\cos y}}{1+\left(e^{e^x\cos y}\right)^2}dy.$$I want to analyze the behavior of the function when $x \rightarrow \infty$.
The strange thing is that when I used Mathematica to plot the function, the graph indicates that $\lim_{x\rightarrow \infty} f(x)=0$. However, it is easy to see that $\liminf_{x\rightarrow \infty}f(x) \ge \frac{\pi}{4}$, since 
$$\int_0^{\pi/2}\frac{2e^{x+e^x\cos y}}{1+\left(e^{e^x\cos y}\right)^2} \, dy \ge \int_0^{\pi/2}\frac{2e^{x+e^x\cos y}\sin y}{1+\left(e^{e^x\cos y}\right)^2}\, dy\\
=-\Big(\tan^{-1}\left(e^{e^x \cos y}\right)\Big)\Big|_{0}^{\pi/2}\\=\tan^{-1}\left(e^{e^x}\right)-\pi/4$$
Now I have two questions:
First, why the result from Mathematica is different from what I obtained? 
Second, does $\lim_{x\rightarrow \infty} f(x)$ exist? 
Maybe this question is not so suitable for mathoverflow, since it is just a calculus problem. However, I just feel so confused about the contradiction of numerical result and math. I want to understand the reason behind this situation. Any comments are really appreciated. Thank you very much.

Below is the code and picure I got from Mathematica....

 A: Mathematica seems to be plotting the function just fine...

If we look a bit at the integrand, it's clear that most of the mass is around $y = \pi/2$ as $x$ increases which should let us introduce a $\sin y$ term and use the antiderative you've already found.

We can try to cut the integral at $\pi/2 - 1/x$.
Let $$I = \int_0^{\pi/2 - 1/x} 2 e^x \frac{e^{e^x \cos y}}{1 + e^{2 e^x \cos y}} dy + \int_{\pi/2 - 1/x}^{\pi/2} 2 e^x \frac{e^{e^x \cos y}}{1 + e^{2 e^x \cos y}} dy = I_0 + I_1$$
Notice that $f(u) = e^u / (1 + e^{2u})$ is a decreasing function of $u$ and thus that 
$$I_0 < (\pi/2 - 1/x) 2 e^x \frac{e^{e^x \cos (\pi/2-1/x)}}{1 + e^{2 e^x \cos (\pi/2-1/x)}} $$
When $x \rightarrow \infty$ the $\cos (\pi/2 - 1/x)$ behaves as $1/x$ and the logistic function $1-\sigma(u)$ behaves as $e^{-u}$, so the right term behaves as $\pi e^{x - e^x /x}$ which converges to $0$.
For $I_1$, we note that if $y \in [\pi/2-1/x,\pi/2]$, $1 - \frac{1}{2x^2} < \sin y \leq 1$
$$I_1 \left(1-\frac{1}{2x^2}\right)< \int_{\pi/2-x}^{\pi/2} 2 e^x \frac{e^{e^x \cos y}\sin y}{1 + e^{2 e^x \cos y}} \leq I_1 $$
The middle term converges to $\pi /2$ and thus so does $I_1$ and so does $I$.
