Gaussian-trigonometric definite integral $\int_0^\infty \frac{e^{-x^2}}{1+a \cos x}dx$ Is it possible to evaluate this integral in closed form?
$$I(a)=\int_0^\infty \frac{e^{-x^2}}{1+a \cos x}dx$$
$$0<a<1$$
I encountered this integral when trying to find a closed form for the series from this question.
Denominator doesn't have any zeroes on the real line, however it does have complex zeroes. I'm not sure how to use residues here, because the usual methods involve either a polynomial in the denominator with infinite limits, or trigonometric functions but with limits $\pm \pi/2$. Which is not the case here.
Another way would be to expand the denominator as the Taylor series, but I don't know the closed form for $\int_0^\infty e^{-x^2} \cos^k x dx$ much less the resulting series.
The function under the integral is even, so the limits can be extended to $\pm \infty$.
 A: 
$\int_0^{+\infty}\frac{e^{-x^2}}{1+a\cos x}~dx=\frac12\sqrt{\frac\pi{1-a^2}}\left(1+2\sum_{n=1}^\infty (-1)^n e^{-\frac{n^2}4}\alpha^n\right)$ where $\alpha=\frac1a-\sqrt{\frac1a^2-1}$

First I intoduce the auxiliary integral:$$\int_0^{2\pi}\frac{\cos(nx)}{1+a \cos(x)}~dx=\frac{2\pi(-1)^n \alpha ^n}{\sqrt{1-a^2}}$$ where $\alpha=\frac1a-\sqrt{\frac1a^2-1}$ and $n\in\mathbb{Z}$.
Proof. $\triangleright$ $$
\begin{align}
\int_0^{2\pi}\frac{\cos(nx)}{1+a \cos(x)}~dx&=\Re\int_0^{2\pi}\frac{e^{nix}}{1+a \cos(x)}~dx=\left[
\begin{matrix}
z=e^{ix}\\
\cos x=\frac12\left(z+\frac1z\right)\\
dx=\frac{dz}{iz}
\end{matrix}
\right]\\
&=\Re\int_{|z|=1}\frac{z^n}{1+\frac a2\left(z+\frac1z\right)}\frac{dz}{iz}
=\Re\int_{|z|=1}\frac{-2iz^n}{az^2+2z+a}~dz\\
&=\Re\left(2\pi i\operatorname*{Res}_{z=-\frac1a+\sqrt{\frac1a^2-1}}\frac{-2iz^n}{az^2+2z+a}\right)=\frac{2\pi(-1)^n \alpha ^n}{\sqrt{1-a^2}}
\end{align}$$
where $\alpha=\frac1a-\sqrt{\frac1a^2-1}$ $\triangleleft$. 
Finally let's crack the initial integral
$$\begin{align}
I=\int_0^{+\infty}\frac{e^{-x^2}}{1+a\cos x}~dx&=\frac12\int_{-\infty}^{+\infty}\frac{e^{-x^2}}{1+a\cos x}~dx\\
&=\frac12\sum_{n=-\infty}^{+\infty}\int_{2\pi n}^{2\pi+2\pi n}\frac{e^{-x^2}}{1+a\cos x}~dx\\
&=\frac12\sum_{n=-\infty}^{+\infty}\int_{0}^{2\pi}\frac{e^{-(x+2\pi n)^2}}{1+a\cos (x+2\pi n)}~dx\\
&=\frac12\sum_{n=-\infty}^{+\infty}\int_{0}^{2\pi}\frac{e^{-x^2-2\pi n x-4\pi^2n^2}}{1+a\cos x}~dx\\
&=\frac12\int_0^{2\pi}\frac{e^{-x^2}\sum_{n=-\infty}^{+\infty}e^{-2\pi n x-4\pi^2n^2}}{1+a\cos x}~dx
\end{align}$$
Next I will use the result of this. After some transforms we get (note that there is a little typo in the question: in the second parameter of theta function the denominator should be equal to $\alpha$ but not $2\alpha$)
$$
I=\frac1{4\sqrt{\pi}}\int_0^{2\pi}\frac{\vartheta_3\left(\frac x2,e^{-\frac14}\right)}{1+a\cos x}~dx
$$ where $\vartheta_3(u,q)$ is one of Jacobi theta functions. I'd like to note that this result impressed me a lot because of it quite simple form. 
Well, let's continue. It's known that theta function could be expressed as a sum: $\vartheta_3(u,q)=1+2\sum_{n=1}^\infty q^{n^2}\cos(2 n u)$. Thus
$$\begin{align}
I&=\frac1{4\sqrt{\pi}}\int_0^{2\pi}\frac{1+2\sum_{n=1}^\infty e^{-\frac14 n^2}\cos(n x)}{1+a\cos x}~dx\\
&=\frac1{4\sqrt{\pi}}
\left(
\int_0^{2\pi}\frac{dx}{1+a\cos x}+2\sum_{n=1}^\infty e^{-\frac14 n^2}\int_0^{2\pi}\frac{\cos(nx)}{1+a \cos(x)}~dx
\right)\\
&=\frac1{4\sqrt{\pi}}
\left(
\frac{2\pi}{\sqrt{1-a^2}}+2\sum_{n=1}^\infty e^{-\frac14 n^2}\frac{2\pi(-1)^n \alpha ^n}{\sqrt{1-a^2}}
\right)\\
&=\frac12\sqrt{\frac\pi{1-a^2}}\left(1+2\sum_{n=1}^\infty (-1)^n e^{-\frac{n^2}4}\alpha^n\right)
\end{align}$$
where $\alpha=\frac1a-\sqrt{\frac1a^2-1}$. 
I tried to find closed form of this infinite sum using theta functions but haven't succeeded so far.
A: This is not a full answer, but may be useful for other users who are interested in this integral. Basically, we are getting back to the series, linked in the other question.
Let's try the series expansion valid for $|a|<1$:
$$\int_0^\infty \frac{e^{-x^2}}{1+a \cos x}dx=\sum_{n=0}^\infty (-1)^n a^n \int_0^\infty e^{-x^2} \cos^n x~dx$$
While I don't know any general expression for the integrals inside, using ' Lord Shark the Unknown's advice, we can certainly compute the first few terms, using:
$$\int_0^\infty e^{-x^2} \cos n x~dx=\frac{\sqrt{\pi}}{2} e^{-n^2/4}$$
See also Expand $\cos^n (x)$ in terms of $\cos{kx}$, $k=1,\dots,n$. which should help to find the general terms of the series (though it would be complicated).
For the first few terms we can explicitly write:
$$\cos^0 x=1 \\ \cos^1 x= \cos x \\ \cos^2 x=\frac{1}{2} (1+\cos 2x) \\ \cos^3 x=\frac{1}{4} (3 \cos x+\cos 3x) \\ \cos^4 x=\frac{1}{8} (3+4 \cos 2x+\cos 4x) \\ \cos^5 x=\frac{1}{16} (10 \cos x+5 \cos 3x+\cos 5x)$$
So we can bound the value of the integral (for $a>0$) by the partial sums:
$$S_4=\sum_{n=0}^4 (-1)^n a^n \int_0^\infty e^{-x^2} \cos^n x~dx$$
and:
$$S_5=\sum_{n=0}^5 (-1)^n a^n \int_0^\infty e^{-x^2} \cos^n x~dx$$
We have:
$$\int_0^\infty e^{-x^2} dx= \frac{\sqrt{\pi}}{2}\\ \int_0^\infty e^{-x^2} \cos x dx= \frac{\sqrt{\pi}}{2} e^{-1/4} \\ \frac{1}{2} \int_0^\infty e^{-x^2}(1+\cos 2x)dx=\frac{\sqrt{\pi}}{4} (1+e^{-1}) \\ \frac{1}{4} \int_0^\infty e^{-x^2}(3 \cos x+\cos 3x)dx=\frac{\sqrt{\pi}}{8} (3 e^{-1/4}+e^{-9/4}) \\ \frac{1}{8} \int_0^\infty e^{-x^2} (3+4 \cos 2x+\cos 4x) dx=\frac{\sqrt{\pi}}{16} (3+4 e^{-1}+e^{-4}) \\ \frac{1}{16} \int_0^\infty e^{-x^2} (10 \cos x+5 \cos 3x+\cos 5x) dx=\frac{\sqrt{\pi}}{32} (10 e^{-1/4}+5 e^{-9/4}+e^{-25/4})$$
We have:
$$S_5(a) < I(a) < S_4(a), \qquad 0<a<1$$
Here's the plot (scaled by $2/\sqrt{\pi}$ for convenience):

A much better approximation would be:
$$I(a) \approx \frac{S_4(a)+S_5(a)}{2}$$
which is a useful general trick for alternating series.
