# The limit $\lim_{x \to 0-} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 } dt$

A while back I derived the following expression valid for $$x>0$$:

$$\sum_{n=1}^\infty e^{-(n+x)^2}= \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 } dt$$

While the integral doesn't converge for $$x=0$$, it has a right limit:

$$\lim_{x \to 0+} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 } dt=\sum_{n=1}^\infty e^{-n^2}=\frac{1}{2} \left(\vartheta _3\left(0,\frac{1}{e}\right)-1\right)$$

But, despite the fact that the integral converges for $$x<0$$, it converges to a different limit from the left side, as can be seen from the numerical plot by Mathematica:

Surprisingly enough, by numerical integration with Mathematica, we seem to have:

$$\lim_{x \to 0-} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 } dt \approx -\frac{1}{2} \left(\vartheta _3\left(0,\frac{1}{e}\right)+1\right)$$

In other words, the limits are related as $$L^- = -1-L^+$$. Is this correct? And why?

Here's the derivation of the first equality https://math.stackexchange.com/a/2751575/269624.

The problematic part is $$\frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 }$$.
Rewrite $$\frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 }=\frac{\left(e^{2x} \cos t-1\right)-e^{2x}\left(e^{2x}-\cos t\right)+e^{2x}\left(e^{2x}-\cos t\right)}{e^{2x}\left(e^{2x}-\cos t\right)-\left(e^{2x}\cos t-1 \right)},$$ which gives $$\frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 }= -1-\frac{e^{2x}\left( \cos t-e^{2x}\right)}{1-2e^{2x} \cos t+e^{4x}}.\tag 1$$
Set $$h=-x$$ for $$x<0$$ and compute $$\frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 }=\frac{e^{-2h} \cos t-1}{e^{-4h}-2e^{-2h} \cos t+1 }= \frac{e^{2h}\left( \cos t-e^{2h}\right)}{1-2e^{2h} \cos t+e^{4h}}.$$ Compare with $$(1).$$
We have \begin{align} L^- &=\lim_{x \to 0^-} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{e^{2x} \cos t-1}{e^{4x}-2e^{2x} \cos t+1 } dt\\ &=\lim_{x \to 0^+} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{e^{-2x} \cos t-1}{e^{-4x}-2e^{-2x} \cos t+1 } dt\\ &=\lim_{x \to 0^+} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{e^{2x} \cos t-e^{4x}}{1-2e^{2x} \cos t+e^{4x} } dt \end{align} hence \begin{align} L^++L^- &=\lim_{x \to 0^+} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} \frac{-1+2e^{2x} \cos t-e^{4x}}{1-2e^{2x} \cos t+e^{4x} }dt\\ &=-\lim_{x \to 0^+} \frac{e^{-x^2}}{\sqrt{\pi}} \int_0^\infty e^{-t^2/4} dt\\ &=-1 \end{align} by the wellknow $$\int_0^\infty e^{-t^2/4}dt=\sqrt\pi$$.