How calculate $\quad \int_0^\infty \frac{\cos(x^2)}{1+x^2} dx$

208 Views Asked by At

How calculate $$\int_0^\infty \frac{\cos(x^2)}{1+x^2}\;dx$$ $\mathbf {My Attempt}$

I tried introducing a new parameter and differentiating twice like this: $$I(a)=\int_0^\infty \frac{\cos(ax^2)}{1+x^2}\;dx \quad \Rightarrow$$ $$I^{''}(a)+I(a)=\frac{\sqrt{\pi}}{\sqrt{2}}a^{\frac{-1}{2}}+\frac{\sqrt{\pi}}{2\sqrt{2}}a^{\frac{-3}{2}}$$ I'm unable to come up with a particular solution for this differential equation.

I tried using a double integral like this: $$\int_0^\infty e^{-y(1+x^2)}\; dy = \frac1{1+x^2} \quad\Rightarrow$$ $$\int_0^\infty \int_0^\infty \cos(x^2)\; e^{-y(1+x^2)}\; dy\,dx = \int_0^\infty\frac{\cos(x^2)}{1+x^2}\; dx$$ But this wasn't that useful.

Result by Wolfram (Mathematica): $$-\frac{1}{2} \pi \left[\sin (1) \left(S\left(\sqrt{\frac{2}{\pi }}\right)-C\left(\sqrt{\frac{2}{\pi }}\right)\right)+\cos (1) \left(C\left(\sqrt{\frac{2}{\pi }}\right)+S\left(\sqrt{\frac{2}{\pi }}\right)-1\right)\right] $$

Any hint? (I'm not familiar with the Residue Theorem)

3

There are 3 best solutions below

2
On BEST ANSWER

Using the complex representation makes the problem solvable with a first order ODE.

$$I(a)=\int_0^\infty\frac{e^{iax^2}}{x^2+1}dx,$$

$$I'(a)=i\int_0^\infty x^2\frac{e^{iax^2}}{x^2+1}dx,$$

$$I'(a)+iI(a)=i\int_0^\infty e^{iax^2}dx=wa^{-1/2},$$ where $w$ is a complex constant (namely $(i-1)\sqrt{\pi/8}$).

Then by means of an integrating factor,

$$(I'(a)+iI(a))e^{ia}=(I(a)e^{ia})'=wa^{-1/2}e^{ia}$$

and integrating from $a=0$ to $1$,

$$I(a)e^{ia}-I(0)=w\int_0^1a^{-1/2}e^{ia}da=2w\int_0^1e^{ib^2}db=2w(C(1)+iS(1)).$$

Finally,

$$I(a)=\left(2w(C(1)+iS(1))+I(0)\right)e^{-i}$$ of which you take the real part. (With $I(0)=\pi/2$.)


Note that we have been using the Fresnel integral without the $\pi/2$ factor in its definition, and this answer coincides with those of the CAS softwares.

8
On

$$J=\int^\infty_0\frac{\cos(x^2)}{1+x^2}dx=\Re\int^\infty_0\frac{e^{ix^2}}{1+x^2}dx=\Re\,\, e^{-i}\underbrace{\int^\infty_0\frac{e^{ia(x^2+1)}}{1+x^2}dx}_{=I(a)}$$ where $a=1$.

Restrict $a$ to be real non-negative.

$$I'(a)=ie^{ia}\int^\infty_0e^{iax^2}dx$$

By the substitution $-u=iax^2$, we get $$I'(a)=\frac12ie^{ia}\sqrt{\frac{i}a}\int^{-i\infty}_0u^{-1/2}e^{-u}du=\frac{i^{3/2}}2\frac{e^{ia}}{\sqrt a}\sqrt\pi$$

Let $k=\frac{i^{3/2}}2\sqrt\pi$.

$$I(a)=k\int\frac{e^{ia}}{\sqrt a}da$$

By the substitution $ia=-v$, we get $$I(a)=k\sqrt i\int\frac{e^{-v}}{\sqrt v}dv=-\frac{\sqrt\pi}2\gamma(\frac12,v)+C=-\frac{\sqrt\pi}2\gamma(\frac12,-ia)+C$$

Because $I(0)=\frac{\pi}2$, so $C=\frac{\pi}2$.

Since $\gamma(\frac12,x)=\sqrt\pi\text{erf}(\sqrt x)$, $$I(a)=-\frac{\pi}2\text{erf}(\sqrt {-i}\sqrt a)+\frac\pi2=\frac\pi2\text{erfc}(\overbrace{e^{-\pi i/4}}^{\text{principal value}}\cdot\sqrt a)$$

As a result, $$J=\Re e^{-i}I(1)=\frac\pi2\,\Re\,\, e^{-i}\text{erfc}(e^{-\pi i/4})$$

Note that $I(1)=-\frac{\sqrt\pi}2\gamma(\frac12,-i)+\frac\pi2$ is wrong if you calculate it using Wolfram Alpha. However, an equivalent expression $I(1) = \frac\pi2\text{erfc}(e^{-\pi i/4})$ is correct as calculated by Wolfram Alpha. I don't know why $-\frac{\sqrt\pi}2\gamma(\frac12,-i)+\frac\pi2\ne \frac\pi2\text{erfc}(e^{-\pi i/4})$. I suspect this might be a bug of Wolfy.

0
On

With a bit of contour integration, we can speed up the convergence: $$\newcommand{\Re}{\operatorname{Re}} \begin{align} \int_0^\infty\frac{\cos\left(x^2\right)}{1+x^2}\,\mathrm{d}x &=\Re\left(\int_0^\infty\frac{e^{ix^2}}{1+x^2}\,\mathrm{d}x\right)\tag1\\ &=\Re\left(\frac{1+i}{\sqrt2}\int_0^\infty\frac{e^{-x^2}}{1+ix^2}\,\mathrm{d}x\right)\tag2\\ &=\frac1{\sqrt2}\int_0^\infty\frac{1+x^2}{1+x^4}e^{-x^2}\,\mathrm{d}x\tag3 \end{align} $$ Explanation:
$(1)$: $\cos\left(x^2\right)=\Re\left(e^{ix^2}\right)$
$(2)$: substitute $x\mapsto\frac{1+i}{\sqrt2}x$
$\phantom{(2)\text{:}}$ change contour from $\frac{1-i}{\sqrt2}[0,\infty]$ to $[0,\infty]$ using Cauchy Integral Theorem
$(3)$: extract real part

Numerically integrating $(3)$ gives $$ \frac1{\sqrt2}\int_0^\infty\frac{1+x^2}{1+x^4}e^{-x^2}\,\mathrm{d}x =0.65280425451173388408\tag4 $$


$$ \begin{align} \int_0^\infty\frac{\cos\left(x^2\right)}{1+x^2}\,\mathrm{d}x &=\Re\left(e^{i\pi/4}\int_0^\infty\frac{e^{-x^2}}{1+ix^2}\,\mathrm{d}x\right)\tag5\\ &=\Re\left(e^{i3\pi/4}e^{-i}\int_0^\infty\frac{e^{i-x^2}}{i-x^2}\,\mathrm{d}x\right)\tag6\\ \end{align} $$ Explanation:
$(5)$: copy $(2)$
$(6)$: multiply by $1=\left(e^{i\pi/2}e^{-i}\right)\left(e^i/i\right)$

Define $$ f(a)=\Re\left(e^{i3\pi/4}e^{-i}\int_0^\infty\frac{e^{a\left(i-x^2\right)}}{i-x^2}\,\mathrm{d}x\right)\tag7 $$ Then $$\newcommand{\Res}{\operatorname*{Res}} \begin{align} f(0) &=\Re\left(e^{i3\pi/4}e^{-i}\int_0^\infty\frac1{i-x^2}\,\mathrm{d}x\right)\\ &=\Re\left(e^{i3\pi/4}e^{-i}\frac12\int_{-\infty}^\infty\frac1{i-x^2}\,\mathrm{d}x\right)\\ &=\Re\left(e^{i3\pi/4}e^{-i}\pi i\Res_{z=e^{i\pi/4}}\left(\frac1{i-z^2}\right)\right)\\ &=\Re\left(\frac\pi2e^{-i}\right)\tag8 \end{align} $$ Taking the derivative of $(7)$, we have $$ \begin{align} f'(a) &=\Re\left(e^{i3\pi/4}e^{-i}\int_0^\infty e^{a\left(i-x^2\right)}\,\mathrm{d}x\right)\\ &=\Re\left(e^{i3\pi/4}e^{-i}e^{ia}\int_0^\infty e^{-ax^2}\,\mathrm{d}x\right)\\ &=\Re\left(e^{i3\pi/4}e^{-i}e^{ia}\sqrt{\frac\pi{4a}}\right)\tag9 \end{align} $$ Integrating $(9)$ gives $$\newcommand{\erf}{\operatorname{erf}}\newcommand{\erfc}{\operatorname{erfc}} \begin{align} f(1)-f(0) &=\Re\left(\frac{\sqrt\pi}2e^{i3\pi/4}e^{-i}\int_0^1\frac{e^{ia}}{\sqrt{a}}\,\mathrm{d}a\right)\tag{10}\\ &=\Re\left(\sqrt\pi e^{i3\pi/4}e^{-i}\int_0^1e^{ia^2}\,\mathrm{d}a\right)\tag{11}\\ &=\Re\left(\sqrt\pi e^{i\pi}e^{-i}\int_0^{e^{-i\pi/4}}e^{-a^2}\,\mathrm{d}a\right)\tag{12}\\[3pt] &=\Re\left(-\frac\pi2e^{-i}\operatorname{erf}\left(e^{-i\pi/4}\right)\right)\tag{13} \end{align} $$ Explanation:
$(10)$: integrate $(9)$ from $0$ to $1$
$(11)$: substitute $a\mapsto a^2$
$(12)$: substitute $a\mapsto ae^{i\pi/4}$
$(13)$: use $\erf$

Combining $(6)$, $(7)$, $(8)$, $(13)$, and $\erfc(x)=1-\erf(x)$, yields $$ \begin{align} \int_0^\infty\frac{\cos\left(x^2\right)}{1+x^2}\,\mathrm{d}x &=\Re\left(\frac\pi2e^{-i}\erfc\left(e^{-i\pi/4}\right)\right)\\ &=0.65280425451173388408\tag{14} \end{align} $$ Thankfully, $(4)$ and $(14)$ agree.