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....

enter image description here

  • 1
    $\begingroup$ you probably made a coding error in Mathematica, when I plot it the limit is about 1.57 $\endgroup$ – Carlo Beenakker Jun 14 at 6:58
  • 2
    $\begingroup$ You missed $2$ in antiderivative, so $\liminf$ is at least $\frac{\pi}{2}$ (which coincides with the number Carlo wrote). I bet that it won't be hard to prove that the the loss in multiplying by $\sin (y)$ is negligible as $x\to \infty$ and so the limit is actually $\frac{\pi}{2}$. $\endgroup$ – Aleksei Kulikov Jun 14 at 7:18
  • $\begingroup$ @CarloBeenakker, thank you very much for the comment... As you can see from my updates, my code should be fine, but when I tried to plot the the graph for $x \in [0,20]$, something went wrong... $\endgroup$ – student Jun 14 at 13:31
  • $\begingroup$ @AlekseiKulikov, exactly! Thank you very much! $\endgroup$ – student Jun 14 at 13:31

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

plot of the function

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.

enter image description here

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$.

| cite | improve this answer | |
  • $\begingroup$ Thank you very much! By the way, I got the same picture for $x$ up to 10, but when I plotted the graph for $x \in [0,20]$, it gives me the limit going to $0$, as you can see from my updates.... $\endgroup$ – student Jun 14 at 13:26
  • $\begingroup$ The support of the mass becomes too small and the numerical integration misses it. If you do a change of variable which blow up the region around pi/2 it'll be more stable. $\endgroup$ – Arthur B Jun 14 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.