Supposedly simple integral

Solution 1:

$\int_0^x\dfrac{e^{-t^2}}{a^2+t^2}dt=\int_0^x\dfrac{1}{a^2+t^2}\sum\limits_{n=0}^\infty\dfrac{(-t^2)^n}{n!}dt=\int_0^x\sum\limits_{n=0}^\infty\dfrac{(-1)^nt^{2n}}{n!(a^2+t^2)}dt$

Consider $\int\dfrac{t^{2n}}{a^2+t^2}dt$ ,

Let $t=a\tan\theta$ ,

Then $dt=a\sec^2\theta~d\theta$

$\therefore\int\dfrac{t^{2n}}{a^2+t^2}dt$

$=\int\dfrac{(a\tan\theta)^{2n}}{a^2+(a\tan\theta)^2}a\sec^2\theta~d\theta$

$=\int a^{2n-1}\tan^{2n}\theta~d\theta$

$=\sum\limits_{k=0}^{n-1}\dfrac{(-1)^ka^{2n-1}\tan^{2n-2k-1}\theta}{2n-2k-1}+(-1)^na^{2n-1}\theta+C$

$=\sum\limits_{k=0}^{n-1}\dfrac{(-1)^ka^{2k}t^{2n-2k-1}}{2n-2k-1}+(-1)^na^{2n-1}\tan^{-1}\dfrac{t}{a}+C$

Hence $\int_0^x\sum\limits_{n=0}^\infty\dfrac{(-1)^nt^{2n}}{n!(a^2+t^2)}dt$

$=\left[\sum\limits_{n=1}^\infty\sum\limits_{k=0}^{n-1}\dfrac{(-1)^{n+k}a^{2k}t^{2n-2k-1}}{n!(2n-2k-1)}+\sum\limits_{n=0}^\infty\dfrac{a^{2n-1}}{n!}\tan^{-1}\dfrac{t}{a}\right]_0^x$

$=\sum\limits_{n=1}^\infty\sum\limits_{k=0}^{n-1}\dfrac{(-1)^{n+k}a^{2k}x^{2n-2k-1}}{n!(2n-2k-1)}+\dfrac{e^{a^2}}{a}\tan^{-1}\dfrac{x}{a}$

Solution 2:

I'll tackle the case of the large values of $x$. Let's express the integral as follows:

$$\int_0^x\frac{e^{-t^2}}{a^2+t^2}dt=\int_0^{\infty}\frac{e^{-t^2}}{a^2+t^2}dt-\int_x^{\infty}\frac{e^{-t^2}}{a^2+t^2}dt=$$

$$=I(a)-\int_x^{\infty}\frac{e^{-t^2}}{a^2+t^2}dt$$

The next step is evaluate the last integral by parts:

$$-\int_x^{\infty}\frac{e^{-t^2}}{a^2+t^2}dt=\frac{1}{2}\int_x^{\infty}\frac{d(e^{-t^2})}{t(a^2+t^2)}dt=$$

$$=-\frac{e^{-x^2}}{2x(a^2+x^2)}+\frac{1}{2}\int_x^{\infty}\frac{(3t^2+a^2)e^{-t^2}}{t^2(a^2+t^2)^2}dt$$

In the last expression, the first term dominates for large $x$ and we have approximately:

$$\int_0^x\frac{e^{-t^2}}{a^2+t^2}dt\approx I(a)-\frac{e^{-x^2}}{2x(a^2+x^2)}$$

We'll get a better result if we continue the integration by parts in the penultimate expression.

Now, consider

$$I(a)=\int_0^{\infty}\frac{e^{-t^2}}{a^2+t^2}dt$$

Let's introduce the parameter $b$ so that

$$J(b)=\int_0^{\infty}\frac{e^{-bt^2}}{a^2+t^2}dt$$

and $I(a)=J(1)$

By differentiating with respect to $b$ we will see that $J$ satisfies the following differential equation:

$$\frac{dJ}{db}-a^2J+\frac{\sqrt{\pi}}{2\sqrt{b}}=0$$

Taking into account that

$$J(0)=\int_0^{\infty}\frac{dt}{a^2+t^2}=\frac{\pi}{2a}$$ we get a solution of this diff-eq:

$$J(b)=\sqrt{\pi}\frac{e^{a^2b}}{a}\int_{a\sqrt{b}}^{\infty}e^{-y^2}dy$$

Finally

$$I(a)=J(1)=\sqrt{\pi}\frac{e^{a^2}}{a}\int_{a}^{\infty}e^{-y^2}dy=\frac{\pi}{2}\frac{e^{a^2}}{a}\text{erfc}(a)$$ where $\text{erfc}(x)=\frac{2}{\sqrt{\pi}}\int_{x}^{\infty}e^{-y^2}dy$ is so called "the complementary error function"