Prove that $ \int_0^\infty \frac{\cos(2\pi x^2)}{\cosh^2(\pi x)}dx=\frac 14$? Recently I was reading Bruce Berndt and George Andrews' book "Ramanujan's lost notebook". Ramanujan showed how to calculate integrals of the form $
\int_0^\infty \frac{\cos(\pi wx^2)}{\cosh(\pi x)}dx
$ when $w\in\mathbb Q$. Inspired by Ramanujan's work I decided to try to compute numerically various similar looking integrals and by coincidence it turned out that $
\int_0^\infty \frac{\cos(2\pi x^2)}{\cosh^2(\pi x)}dx=0.250000000000000000...
$ It looks like this integral is $\frac 14$, but I have no clue how to prove it.

Question: How to prove that $$ \int_0^\infty \frac{\cos(2\pi x^2)}{\cosh^2(\pi x)}dx=\frac 14 ?$$

 A: I'm busy today so some arguments have to be more rigorous
Denote the integral in question by $I$ (which by symmetry can be extended to the whole real line)
$$
I=\int_{0}^{\infty}\frac{\cos(2\pi x^2)}{\cosh^2(\pi x)}
$$
Now consider the complex valued function
$$
f(z)=\frac{e^{i 2 \pi z^2}}{\sinh(4 \pi z)\cosh(\pi z)^2}
$$
then 
$$f(x\pm i)=\frac{ e^{i 2 \pi x^2\mp 4 \pi x}}{\sinh(4 \pi z)\cosh(\pi z)^2}$$
Furthermore integrating $f(z)$ around a rectangle $(-i -\infty,i -\infty,i +\infty,-i +\infty)$ in counterclockwise direction yields
$$
\oint_C f(z)=\int_{\mathbb{R}}f(x+i)-\int_{\mathbb{R}}f(x-i)=2\pi i \sum\text{Res}(f(z),z\in C )
$$
but $\int_{\mathbb{R}}f(x+i)-f(x-i)=2 \int_{\mathbb{R}}\frac{e^{i 2 \pi x^2}}{\cosh(\pi x)^2}$. 
The real part of this integral is just four times the  integral we are looking for, $I$. 
$$
4 I=2\Re \int_{\mathbb{R}}\frac{e^{i 2 \pi x^2}}{\cosh(\pi x)^2}=\Re\left[2 i\pi \sum_{\sigma=\pm}\text{Res}(f(z),z=\sigma\frac{i}{2})\right]
$$
since it turns out that only the residues at $z=\pm \frac{i}{2}$ a) have finite imaginary part and b) don't cancel so they are the only contributions to the real part of the above expression, given by $\text{Res}(f(z)=z=\pm \frac{i}{2})=-\frac{2+i \pi}{4\pi^2}$.
Putting everything together we obtain

$$
I=\frac{1}{4}\Re\left[-2 \pi i \left(\frac{2+i\pi}{4 \pi^2}+\frac{2+i\pi}{4 \pi^2}\right)\right]=\frac{1}{4}
$$

QED

Note that with some more (straightforward) work, also the integral with $\sin(2\pi x^2)$ in the numerator can be extracted from the above calculation by taking imaginary parts.
$$
\int_{0}^{\infty}\frac{\sin(2\pi x^2)}{\cosh^2(\pi x)}=\frac{1}{4}-\frac{1}{2\pi}
$$
