What is the solution to this integral?

In some calculation, I encounter an integral of the form

\begin{equation} \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b z}, \end{equation} where $a>0$ and $b$ are some real constants.

Here is what I've tried so far. I thought to have a clever trick up my sleeve. Namely, since $z$ is real, one can rewrite $z^2=|z|^2$, and do the integral over a contour in the complex plane. The contour is the real line and a semi-cirle 'at infinity'. The integral over this semi-circle would be zero. So: \begin{equation} \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b z}=\oint_C \text dz\ \frac{1}{z-i\varepsilon}e^{- a |z|^2+i b z}\overset{?}{=}2\pi i \ \underset{z=i\varepsilon} {\text{Res}}\ \frac{1}{z-i\varepsilon}e^{- a |z|^2+i b z}. \end{equation} However, this does not agree with the numerical solution for the integral (where I pick some $a$ and $b$ randomly).

Now the quastion is: why does this not work, and what $is$ the correct solution?

• The residue formula is valid only for analytic functions. Modulo (and therefore the rest) is not. – user58697 Jul 29 '15 at 21:21

$I = \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b z} = \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b (z - i\varepsilon +i\varepsilon)} = e^{-b\varepsilon}\int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b (z - i\varepsilon)}$, that is
$$e^{b\varepsilon}I = \int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b (z - i\varepsilon)}$$ and $$\frac{d}{db}(e^{b\varepsilon}I) =i\,e^{b\varepsilon}\int_{-\infty}^\infty \text dz\ e^{- a z^2+i b z}$$ $\ \ \ \ \ \$ Can you take it from here?
• Yes, I can take it from there! For completeness, I will here take it from there... Your last expression evaluates as $i\sqrt{\frac{\pi}{a}}e^{-\frac{b^2}{4a}+b\varepsilon}$. Therefore, $e^{b\varepsilon}I=i\pi e^{a\varepsilon^2}\mathrm{erf}[\frac{b-2a\varepsilon}{2\sqrt{a}}]+C(a)$, where erf is the error function and C(a) some function of a (not of $b$). We can find the constant by setting $I|_{b=0}=\int_{i\infty}^\infty \text{d}z\frac{e^{-az^2}}{z-i\varepsilon}=ie^{a\varepsilon^2\pi}(1-\mathrm{erf}(\varepsilon \sqrt{a}))$ equal to the solution we found earlier. – Georg Jul 30 '15 at 13:13
• This yields the final result: $\int_{-\infty}^\infty \text dz\ \frac{1}{z-i\varepsilon}e^{- a z^2+i b z}=i\pi e^{a\varepsilon^2-b\varepsilon}[1+\mathrm{erf}(\frac{b-2a\varepsilon}{2\sqrt{a}})]$. – Georg Jul 30 '15 at 13:19