<s>[INST] Does this integral have an analytical solution? (The residue theorem method seems to fail here) The integral is the following:
\begin{equation}
  \int_{-\infty}^{+\infty}dx \frac{e^{-{\sigma}^2(x+b)^2}}{x^2+a^2}
\end{equation}
I know there is an analytical solution when $b=0$. But what about $b\neq0$ ?
 [/INST] May be, we could try to expand the exponential as
$$e^{-\sigma ^2 (x+b)^2}=e^{-\sigma ^2 x^2}\sum_{n=0}^\infty (-1)^n P_n(x)\, b^n$$ and face integrals
$$I_n=\int_{-\infty}^\infty \frac {x^n} {x^2+a^2}e^{-\sigma ^2 x^2}\, dx=a^{n-1}\int_{-\infty}^\infty \frac{t^n}{t^2+1}e^{-k t^2}\,dt\qquad \text{where}\qquad k=a^2\sigma ^2$$ For sure, for odd $n$, the result is zero
$$I_{2n}= e^k \,\Gamma \left(\frac{2n+1}{2}\right)\, \Gamma \left(\frac{1-2n}{2},k\right)$$
Let $k=c^2$ and the $I_{2n}$ write
$$I_{2n}=(-1)^{n+1} \Bigg[\frac{\sqrt \pi}{2^{n-1} c^{2 n-1} } Q_{n}(c)-\pi  e^{c^2} \text{erfc}(c) \Bigg]$$
$$\left(
\begin{array}{cc}
n & Q_n(c) \\
 1 & 1 \\
 2 & 2 c^2-1 \\
 3 & 4 c^4-2 c^2+3 \\
 4 & 8 c^6-4 c^4+6 c^2-15 \\
 5 & 16 c^8-8 c^6+12 c^4-30 c^2+105 \\
 6 & 32 c^{10}-16 c^8+24 c^6-60 c^4+210 c^2-945 \\
 7 & 64 c^{12}-32 c^{10}+48 c^8-120 c^6+420 c^4-1890 c^2+10395 \\
 8 & 128 c^{14}-64 c^{12}+96 c^{10}-240 c^8+840 c^6-3780 c^4+20790 c^2-135135 
\end{array}
\right)$$
where clear and simple patterns appear.
</s>