Expressing a Gaussian-like integral in terms of error function, faliure of Glasser’s master theorem

definite integralserror functionimproper-integralsintegration

So I have this integral $$
I=\int_0^c\exp\left(-a^2x^2-\frac{b^2}{x^2}\right)\,dx, \quad(a,b>0)
$$
This is what I tried to write it in terms of error function.
$$
I=e^{-2ab}\int_0^c\exp\left(-a^2\left(x-\frac{b}{ax}\right)^2\right)\,dx
$$
By Glasser's master theorem
$$
I=e^{2ab}\int_0^ce^{-a^2x^2}\,dx=\frac{\sqrt\pi e^{2ab}}{2a}\text{erf}(ac)
$$
But according to eq 5 here the correct answer is
$$
I=\frac{\sqrt\pi}{4a}(e^{2ab}\text{erf}(ax+b/x)+e^{-2ab}\text{erf}(ax-b/x))
$$
What went wrong here and how to get the correct answer?

Best Answer

Without loss of generality we can assume $c>0$ , since $c<0$ only changes the sign of the integral.

As already discussed in the comments, Glasser's master theorem does not apply here. We can instead write the integral as $$ I = \mathrm{e}^{2ab} \int \limits_0^c \mathrm{e}^{-(a x + b/x)^2} \, \mathrm{d} x \, .$$

Now we would like to let $a x + b/x = t$ . Since this map is not bijective, we need to be careful here! For $0<x<\sqrt{b/a}$ the correct inverse is $$x = \frac{1}{2a} \left(t-\sqrt{t^2-4ab}\right) \, ,$$ while for $x > \sqrt{b/a}$ we have to use $$x = \frac{1}{2a} \left(t+\sqrt{t^2-4ab}\right) \, .$$


For $c \leq \sqrt{b/a} \, \Leftrightarrow \, a c - b/c \leq 0$ we only need the first version. The substitution yields $$ I = \frac{\mathrm{e}^{2ab}}{2a} \int \limits_{ac+b/c}^\infty \left[\frac{t}{\sqrt{t^2-4ab}} - 1\right]\mathrm{e}^{-t^2} \, \mathrm{d} t \, . $$ Changing variables once more for the first part ($u = \sqrt{t^2 - 4ab}$) and using the complementary error function $\operatorname{erfc} = 1-\operatorname{erf}$ we obtain $$ I = \frac{\sqrt{\pi}}{4a} \left[\mathrm{e}^{-2ab} \operatorname{erfc}(|ac - b/c|) - \mathrm{e}^{2ab} \operatorname{erfc}(ac + b/c)\right] \, .$$


For $c > \sqrt{b/a} \, \Leftrightarrow \, a c - b/c > 0$ we have to split the integral: \begin{align} I &= \mathrm{e}^{2ab} \left\{\int \limits_0^\sqrt{b/a} \mathrm{e}^{-(a x + b/x)^2} \, \mathrm{d} x + \int \limits_\sqrt{b/a}^c \mathrm{e}^{-(a x + b/x)^2} \, \mathrm{d} x \right\} \\ &= \frac{\mathrm{e}^{2ab}}{2a} \left\{\int \limits_{2\sqrt{ab}}^\infty \left[\frac{t}{\sqrt{t^2-4ab}} - 1\right]\mathrm{e}^{-t^2} \, \mathrm{d} t + \int \limits_{2\sqrt{ab}}^{ac+b/c} \left[1 + \frac{t}{\sqrt{t^2-4ab}}\right]\mathrm{e}^{-t^2} \, \mathrm{d} t \right\} \, . \end{align} Evaluating the remaining integrals as in the other case we find $$ I = \frac{\sqrt{\pi}}{4a} \left[\mathrm{e}^{-2ab} [1+\operatorname{erf}(ac - b/c)] - \mathrm{e}^{2ab} \operatorname{erfc}(ac + b/c)\right] \, .$$


Both results can be simplified and the final result for arbitrary $c>0$ is \begin{align} I &= \frac{\sqrt{\pi}}{4a} \left[\mathrm{e}^{-2ab} \operatorname{erfc}(b/c - ac) - \mathrm{e}^{2ab} \operatorname{erfc}(b/c + ac)\right] \\ &= \frac{\sqrt{\pi}}{4a} \left[\mathrm{e}^{2ab} \operatorname{erf}(ac+b/c) + \mathrm{e}^{-2ab} \operatorname{erf}(ac-b/c) - 2 \sinh(2ab)\right] \, , \end{align} which agrees with the result from the table (except for a constant, of course). Letting $c \to \infty$ we obtain the integral $$ \int \limits_{-\infty}^\infty \mathrm{e}^{-a^2 x^2 - b^2 /x^2} \, \mathrm{d} x = \frac{\sqrt{\pi}}{a} \mathrm{e}^{-2ab} \, , $$ which can also be computed using the master theorem.

Related Question