Rational Fresnel -type integral. I have a question about an integral that looks like a great candidate for residues. 
$\displaystyle \int_{0}^{\infty}\frac{\cos(x^{2})}{x^{4}+1}dx-\int_{0}^{\infty}\frac{\sin(x^{2})}{x^{4}+1}dx=\frac{\pi\sqrt(2)}{4e}$.
My difficulty arises in knowing how to come up with the proper contour for something like this.
Does anyone know of a good method for evaluating the above integral using residue theory, or even real methods?. 
Take the cosine one.
I wrote it out as $\displaystyle\int_{C}\frac{e^{iz^{2}}}{z^{4}+1}dz$.
Where C is the semicircular contour in the upper half plane. 
The zeroes of the denominator are $\displaystyle e^{\frac{\pi i}{4}}, \;\ e^{\frac{3\pi i}{4}}, \;\ e^{\frac{5\pi i}{4}}, \;\ e^{\frac{7\pi i}{4}}$.  Of which the first two lie in the upper half plane. 
The residue at $\displaystyle e^{\frac{\pi i}{4}}$ is $\frac{-\sqrt{2}}{8e}-\frac{\sqrt{2}i}{8e}$
The residue at $\displaystyle e^{\frac{3\pi i}{4}}$ is $\frac{e\sqrt{2}}{8}-\frac{e\sqrt{2}i}{8}$
Summing them: $\displaystyle 2\pi i\left(\frac{-\sqrt{2}}{8e}-\frac{\sqrt{2}i}{8e}+\frac{e\sqrt{2}}{8}-\frac{e\sqrt{2}i}{8}\right)$
$\displaystyle =\frac{(e^{2}+1)\pi\sqrt{2}}{4e}+\frac{(e^{2}-1)\pi\sqrt{2}}{4e}\cdot i$
But, this is not the correct result... numerically. No doubt, it is not that straightforward because I have chosen an incorrect contour. Perhaps due to the Fresnel-type term in the numerator.  Can anyone lend any insight on this one?. 
Thanks very much. 
 A: Try the quarter-circle contour that goes out on the positive real axis, turns counter-clockwise, and then comes down the positive imaginary axis. The motivation is to respect symmetry of the integrand.
The only residue enclosed by this contour, which I'll call $C$, is at $e^{i\pi/4}$, which you've already computed as $-\frac{\sqrt{2}}{8e}(1+i)$. Then we have
$$\frac{\pi\sqrt{2}}{4e}(1-i)=\int_C dz\,\frac{e^{iz^2}}{z^4+1}=\int_1+\int_2+\int_3$$
where $\int_1$, $\int_2$, $\int_3$ refer to the integrals over the three pieces of the contour. $1$ is going out on the real axis, $2$ is the circular arc going CCW by $\pi/2$ and $3$ is going down the imaginary axis. The circular piece, $2$, contributes $0$ in the limit of the contour getting really big, so we won't bother with it.
Now the interesting part is $3$, where we parametrize by $z=it$, $t=\infty\ldots 0$ and compute
$$\int_3=\int_3 dz\,\frac{e^{iz^2}}{z^4+1}=-\int_0^\infty i dt\,\frac{e^{-it^2}}{t^4+1}.$$
This is $-i$ times the complex conjugate of $\int_1$. Hence the residue theorem says
$$\frac{\pi\sqrt{2}}{4e}(1-i)=\int_1-i\left(\int_1\right)^*.$$
The integral in question is really $I={\rm Re}(\int_1)$. Take the real and imaginary parts of the equation above and solve for $I$ to find
$$I=\frac{\pi\sqrt{2}}{4e}.$$
