Need help with $\int_0^\infty\left(\pi\,x+\frac{S(x)\cos\frac{\pi x^2}2-C(x)\sin\frac{\pi x^2}2}{S(x)^2+C(x)^2}\right)dx$
Solution 1:
Notice the integrand can be rewritten as:
$$\pi x + \frac{S C' - C S'}{S^2 + C^2} = \pi x + \frac{1}{2i}\left(\frac{C' - iS'}{C - iS} - \frac{C' + iS'}{C + iS}\right) = \pi x + \frac{1}{2i} \log\left(\frac{C-iS}{C+iS}\right)' $$ The integral is equal to
$$\lim_{x\to\infty} \left[\frac{\pi t^2}{2} + \frac{1}{2i}\log\left(\frac{C(t)-iS(t)}{C(t)+iS(t)}\right)\right]_0^x =\lim_{x\to\infty} \left(\frac{\pi x^2}{2} + \Im ( \log M(x) )\right) $$ where $\displaystyle\quad M(x) = \frac{C(x)-iS(x)}{C(0)-iS(0)}$.
Using $$\int_0^{\infty} \cos \frac{\pi t^2}{2} dt = \int_0^{\infty} \sin \frac{\pi t^2}{2} dt = \frac12,$$ we can simplify $M(x)$ to
$$\begin{align} \frac{\color{red}{-}\int_{x}^{\infty} e^{-i\frac{\pi}{2} t^2}dt}{\color{red}{-\frac12+\frac12 i}} = & \sqrt{2}e^{i(\color{red}{\frac{\pi}{4}}-\color{blue}{\frac{\pi}{2}x^2})}\int_0^{\infty} e^{-i(\frac{\pi}{2} t^2 + \pi x t)} dt\\ \sim & \frac{\sqrt{2}}{\color{green}{i} \pi x} e^{i(\color{red}{\frac{\pi}{4}}-\color{blue}{\frac{\pi}{2}x^2})}( 1 + O(\frac{1}{x}) ) \quad\text{ for large } x. \end{align} $$ From this, we find the integral equals to $$\lim_{x\to\infty} \left( \frac{\pi x^2}{2} + \color{red}{\frac{\pi}{4}} - \color{green}{\frac{\pi}{2}} - \color{blue}{\frac{\pi x^2}{2}} + O(\frac{1}{x}) \right) = -\frac{\pi}{4}.$$