Integration involving a complex exponential (over the complete real region) How can I find the the following integral:
$$\mathcal{I}\left(\text{k},\text{z}\right)=\int_\mathbb{R}\exp\left[\frac{\pi\left(2x\text{z}-\text{k}\right)^2i}{2\text{z}}\right]\space\text{d}x=\int_{-\infty}^\infty\exp\left[\frac{\pi\left(2x\text{z}-\text{k}\right)^2i}{2\text{z}}\right]\space\text{d}x$$
Where $\text{k}$ is an integer number and $\text{z}$ is a complex number.
For the undefinte integral we can write using the substitution $\text{u}=2x\text{z}-\text{k}$:
$$\int\exp\left[\frac{\pi\left(2x\text{z}-\text{k}\right)^2i}{2\text{z}}\right]\space\text{d}x=\frac{1}{2\text{z}}\int\exp\left[\frac{\pi\text{u}^2i}{2\text{z}}\right]\space\text{d}\text{u}$$
Looking back at the definite integral the boundaries will become realy 'weird' after the use of the substitution. When I look at the lower bound it will something be, like this:
$$\text{u}=2\left(-\infty\right)\text{z}-\text{k}$$

So, how can I compute $\mathcal{I}\left(\text{k},\text{z}\right)$?

 A: It is a clever way to use the well known result
$$\int_0^\infty e^{-x^2}\cos 2bx \,dx=\frac{\sqrt{\pi}}{2}e^{-b^2},\quad \text{or}\,\,\int_0^\infty e^{-ax^2}\cos 2k\pi x \,dx=\frac{\sqrt{\pi}}{2\sqrt{a}}\,e^{-\frac{k^2\pi^2}{a}}\quad (a>0).
$$
We rewrite $\mathcal{I}\left(k,z\right)$ :
\begin{align}
\mathcal{I}\left(k,z\right)&=\int_{-\infty}^\infty\exp\left[\frac{\pi\left(2xz-k\right)^2i}{2z}\right]dx
=\exp\left(\frac{k^2\pi^2}{2z}i\right)\int_{-\infty}^\infty\exp\left(2\pi izx^2-2k\pi ix\right)dx\\
&=\exp\left(\frac{k^2\pi^2}{2z}i\right)\int_{-\infty}^\infty\exp\left(-ax^2-2k\pi ix\right)dx,
\end{align}
where $a=-2\pi iz.$ The integral converges for $a$ with $\operatorname{Re}a>0$ , in other words for $z$ with $\operatorname{Im} z>0$.
First we consider the case $a$ is real and positive. Then
\begin{align}
\int_{-\infty}^\infty e^{-ax^2-2k\pi ix}dx&=\int_{-\infty}^0 e^{-ax^2-2k\pi ix}dx
+\int_0^\infty e^{-ax^2-2k\pi ix}dx\\
&=-\int_{\infty}^0 e^{-at^2+2k\pi it}dt+\int_0^\infty e^{-ax^2-2k\pi ix}dx\\
&=\int_0^\infty e^{-ax^2}\left(e^{2k\pi ix}+e^{-2k\pi ix}\right)dx\\
&=2\int_0^\infty e^{-ax^2}\cos 2k\pi x\,dx\\
&=\frac{\sqrt{\pi}}{\sqrt{a}}\exp\left(-{\frac{k^2\pi^2}{a}}\right).
\end{align}
Thus we have \begin{align}
\mathcal{I}\left(k,z\right)=\frac{1}{\sqrt{-2iz}}\tag{1}
\end{align}
for $z$ with $z=iv,$ $v>0.$
By Identity Theorem $(1)$ holds for all $z$ with $\operatorname{Im} z>0$.
