Imaginary Gaussian integral I want to do the integral
$$
\int dx e^{ -\frac{a}{2}\pi i x^2}dx = \sqrt{\frac{2\pi}{ia}}
$$
for $a = 1$. But the above result is conditional on Im${(a)}>0$. Therefore it is not as simple to take the limit to the limit $a \to 1$. So I wonder what is the right approach here. Mathematica spits out 
$$\frac{1-i}{\sqrt{2}}$$
but I am not sure how this is obtained or why it is the correct one. Ok, maybe the solution is trivial, I do not know it though.
 A: You can make an analytic continuation in the complex plane $z = x + i y$. Consider the closed contour as shown in the figure

Since the function has no poles in the domain enclosed by the contour $c$, then 
$$
\oint_c {\rm d}z~ e^{-\frac{1}{2}\pi i z^2} = 0
$$
Moreover, once you decompose the integral the problem reduces to
$$
\oint_c {\rm d}z~ e^{-\frac{1}{2}\pi i z^2} = \int_{c_2} {\rm d}z~ e^{-\frac{1}{2}\pi i z^2} + \int_{c_4} {\rm d}z~ e^{-\frac{1}{2}\pi i z^2} = 0 \tag{1}
$$
The integral over $c_1$ and $c_3$ vanishes, in the limit when the contour stretches to infinity. $c_4$ is the integral you want to calculate, the only term that is left is the one associated with $c_2$, for that one consider the parametrization
$$
x = t, ~~~ y = -i t, ~~~~ z = x + iy = (1 - i)t
$$
so that
\begin{eqnarray}
\int_{c_4} {\rm d}z~ e^{-\frac{1}{2}\pi i z^2} &=& \int_{+\infty}^{-\infty}{\rm d}t ~(1-i)e^{-\frac{1}{2}\pi i (1-i)^2t^2} \\ 
&=& -(1-i)\int_{-\infty}^{+\infty}e^{\frac{1}{2}\pi t^2} \\
&=& -(1-i) \tag{2}
\end{eqnarray}
Replacing (2) in (1):
$$
\int_{c_2} {\rm d}z~ e^{-\frac{1}{2}\pi i z^2} = i - 1
$$
But over $c_2$ we have $z = x$, so that 
$$
\int_{-\infty}^{+\infty} {\rm d}x~ e^{-\frac{1}{2}\pi i x^2} = i - 1
$$
That matches the result from WolframAlpha
