4
$\begingroup$

I found the following integral evaluation very interesting to me:

Integral of product of two error functions (erf)

and I hoped that I could use that result to evaluate the following integral: $$ \int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\,\mathrm{erfc}\left(t-c\right)\,\mathrm{erfc}\left(d-t\right)\,\mathrm{d}t=\frac{4}{\pi}\int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\int_{t-c}^{\infty}\int_{d-t}^{\infty}\exp\left(-u^{2}-v^{2}\right)\,\mathrm{d}u\,\mathrm{d}v\,\mathrm{d}t $$

So I note that $u\geq t-c$, $v\geq d-t$,
thus $t\leq u+c$ and $t\geq d-v$,
thus $d-v\leq t\leq u+c$ and $u+v\geq d-c$.

Hence $$ \frac{4}{\pi}\int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\int_{d-t}^{\infty}\int_{t-c}^{\infty}\exp\left(-u^{2}-v^{2}\right)\,\mathrm{d}u\,\mathrm{d}v\,\mathrm{d}t= $$ $$ \qquad\qquad =\frac{4}{\pi}\int\!\int_{u+v>d-c}\exp\left(-u^{2}-v^{2}\right)\,\int_{d-v}^{u+c}\exp\left(-t^{2}\right)\,\mathrm{d}t\,\mathrm{d}u\,\mathrm{d}v $$

I know that $$ \int_{d-v}^{u+c}\exp\left(-t^{2}\right)\,\mathrm{d}t=\frac{1}{2}\sqrt{\pi}\left(\mathrm{erf}\left(u+c\right)-\mathrm{erf}\left(d-v\right)\right) $$

but I don't quite understand how I should deal with $$\frac{4}{\pi}\int\!\int_{u+v>d-c}\exp\left(-u^{2}-v^{2}\right)\mathrm{d}u\,\mathrm{d}v\,. $$ What limits of integration I should use there? Thanks for any suggestions.

$\endgroup$
0
$\begingroup$

Let $c \in {\mathbb R}$ and $d \in {\mathbb R}$. Without loss of generality we can consider a slightly different function: \begin{equation} f(c,d):= \int\limits_{-\infty}^\infty \exp(-t^2) \mbox{erfc}(t-c) \mbox{erfc}(t-d) dt \end{equation} Now we differentiate with respect to $c$. We have: \begin{eqnarray} \partial_c f(c,d) &=& \lim\limits_{\epsilon \rightarrow 0} \frac{\sqrt{2}}{\sqrt{\pi}} \exp(-\frac{c^2}{2}) \left( \sqrt{\pi} + 2 \sqrt{\pi} T(\epsilon,\frac{1}{\sqrt{2}},\frac{2d-c}{\sqrt{2}}) - 2 \sqrt{\pi} T(\epsilon,\frac{1}{\sqrt{2}},\frac{-2d+c}{\sqrt{2}})\right)\\ &=&\sqrt{2} \exp(-\frac{c^2}{2}) \left( 1-erf(\frac{c-2 d}{\sqrt{6}})\right) \end{eqnarray} where $T(h,a,b)$ is the generalized Owen's T function Generalized Owen's T function .

Now, all we need to do is to integrate. Since $f(-\infty,d)=0$ we integrate over $c$ from minus infinity to $c$. We have: \begin{eqnarray} f(c,d) &=& \sqrt{2} \left( \sqrt{\frac{\pi}{2}}(1+erf(\frac{c}{\sqrt{2}}) + 2erf(\frac{d}{\sqrt{2}})) + \sqrt{2 \pi} 2 T(c,\frac{1}{\sqrt{3}},-\frac{2 d}{\sqrt{3}})\right) \\ &=& \frac{1}{3 \sqrt{\pi}} \left( 12 \pi T\left(c,\frac{c-2 d}{\sqrt{3} c}\right)+12 \pi T\left(d,\frac{d-2 c}{\sqrt{3} d}\right)-6 \arctan\left(\frac{c-2 d}{\sqrt{3} c}\right)-6 \arctan\left(\frac{d-2 c}{\sqrt{3} d}\right)+3 \pi \text{erf}\left(\frac{c}{\sqrt{2}}\right)+3 \pi \text{erf}\left(\frac{d}{\sqrt{2}}\right)+4 \pi\right) \end{eqnarray} where $T(h,a)$ is Owen's T function https://en.wikipedia.org/wiki/Owen%27s_T_function .

In[1060]:= {c, d} = RandomReal[{-2, 2}, 2, WorkingPrecision -> 50];
NIntegrate[Exp[-t^2] Erfc[t - c] Erfc[t - d], {t, -Infinity, Infinity}]
(4 \[Pi] - 6 ArcTan[(c - 2 d)/(Sqrt[3] c)] - 
 6 ArcTan[(-2 c + d)/(Sqrt[3] d)] + 3 \[Pi] Erf[c/Sqrt[2]] + 
 3 \[Pi] Erf[d/Sqrt[2]] + 12 \[Pi] OwenT[c, (c - 2 d)/(Sqrt[3] c)] + 
 12 \[Pi] OwenT[d, (-2 c + d)/(Sqrt[3] d)])/(3 Sqrt[\[Pi]])

Out[1061]= 0.483318

Out[1062]= 0.48331807775609703646923225386370751256977344715

Update: Now let us take four real numbers $a_1 \in {\mathbb R}$, $a_2 \in {\mathbb R}$, $c\in {\mathbb R}$ and $d \in {\mathbb R}$ and consider a more general integral: \begin{equation} f^{(a_1,a_2)}(c,d):= \int\limits_{-\infty}^\infty \exp(-t^2) \mbox{erfc}(a_1 t-c) \mbox{erfc}(a_2 t-d) dt \end{equation} Then by doing the same calculations as above we easily arrive at the following formula: \begin{eqnarray} &&f^{(a_1,a_2)}(c,d)= \frac{1}{\sqrt{\pi}} \left(\right.\\ && 4 \pi T\left(\frac{\sqrt{2} c}{\sqrt{a_1^2+1}},\frac{a_1 a_2 c-\left(a_1^2+1\right) d}{c \sqrt{a_1^2+a_2^2+1}}\right)+4 \pi T\left(\frac{\sqrt{2} \sqrt{a_1^2+1} d}{\sqrt{a_1^2 a_2^2+a_1^2+a_2^2+1}},\frac{a_1 a_2 d-\left(a_2^2+1\right) c}{d \sqrt{a_1^2+a_2^2+1}}\right) +\\ &&-2 \arctan\left(\frac{a_1 a_2 c-\left(a_1^2+1\right) d}{c \sqrt{a_1^2+a_2^2+1}}\right)-2 \arctan\left(\frac{a_1 a_2 d-\left(a_2^2+1\right) c}{d \sqrt{a_1^2+a_2^2+1}}\right)+\\ &&\pi \text{erf}\left(\frac{\sqrt{a_1^2+1} d}{\sqrt{a_1^2 a_2^2+a_1^2+a_2^2+1}}\right)+\pi \text{erf}\left(\frac{c}{\sqrt{a_1^2+1}}\right)+\\ &&\pi +2 \arctan\left(\frac{a_1 a_2}{\sqrt{a_1^2+a_2^2+1}}\right)\\ &&\left.\right) \end{eqnarray}

For[count = 1, count <= 200, count++,
  {a1, a2, c, d} = RandomReal[{-5, 5}, 4, WorkingPrecision -> 50];
  I1 = NIntegrate[
    Exp[-t^2] Erfc[a1 t - c] Erfc[a2 t - d], {t, -Infinity, Infinity}];
  I2 = 1/Sqrt[\[Pi]] (\[Pi] + 
      2 ArcTan[(a1  a2)/Sqrt[(1 + a1^2 + a2^2)]] - 
      2 ArcTan[ (a1 a2 c - (1 + a1^2) d)/(
        Sqrt[(1 + a1^2 + a2^2)] c)] - 
      2 ArcTan[ (a1 a2 d - (1 + a2^2) c)/(
        Sqrt[(1 + a1^2 + a2^2)] d)] + \[Pi] Erf[c/Sqrt[
        1 + a1^2]] + \[Pi] Erf[(Sqrt[(1 + a1^2)] d)/ Sqrt[
        1 + a1^2 + a2^2 + a1^2 a2^2]] + 
      4 \[Pi] OwenT[(Sqrt[2] c)/Sqrt[
        1 + a1^2],  (a1 a2 c - (1 + a1^2) d)/(
        Sqrt[(1 + a1^2 + a2^2)] c)] + 
      4 \[Pi] OwenT[(Sqrt[2] Sqrt[(1 + a1^2)] d)/ Sqrt[
        1 + a1^2 + a2^2 + a1^2 a2^2],  (a1 a2 d - (1 + a2^2) c)/(
        Sqrt[(1 + a1^2 + a2^2)] d)]);
  If[Abs[I2/I1 - 1] > 10^(-3), 
   Print["results do not match", {a1, a2, c, d, {I1, I2}}]; Break[]];
  If[Mod[count, 10] == 0, PrintTemporary[count]];
  ];
$\endgroup$
  • $\begingroup$ Where were you when I needed this answer the most? ;-) This question is so old! Nevertheless I'll try to dust off my the research I needed the answer for, simply out of curiosity. I love that you added Mathematica code! Thank you! $\endgroup$ – petru Mar 23 at 18:01
  • $\begingroup$ @petru I was wondering in what context did you come across this problem? $\endgroup$ – Przemo Mar 25 at 10:48
  • $\begingroup$ It was theoretical analysis of a very simple evolutionary algorithm. Part of what I was trying to achieve was more or less to evaluate a triple integral of a product of three Gaussian functions, $\int_{-\infty}^{\infty}\int_{-\infty}^{x_1}\int_{-\infty}^{x_2}\ldots \text{d}x_3\text{d}x_2\text{d}x_1$, to give you a general idea. $\endgroup$ – petru Mar 28 at 18:18
1
$\begingroup$

You can rotate coordinates. To do so, apply the following change of variables: $$\begin{cases} x = \frac{1}{\sqrt{2}} (u - v) \\ y = \frac{1}{\sqrt{2}} (u+v) \end{cases}$$ This leads to nicer integral: $$\int\int_{u+v > d-c} e^{-(u^2 + v^2)} \, du\,dv = \int_{\frac{1}{\sqrt{2}}(d-c)}^\infty \int_{-\infty}^{+\infty} e^{-x^2 - y^2} \, dx \,dy$$

$\endgroup$
0
$\begingroup$

Ok, so after some manipulations and using the integral $$ \int_{-\infty}^{\infty}\exp\left(-b^{2}(x-c)^{2}\right)\mathrm{erf}\left(a\left(x-d\right)\right)\,\mathrm{d}x=\frac{\sqrt{\pi}}{b}\mathrm{erf}\left(\frac{ab\left(c-d\right)}{\sqrt{a^{2}+b^{2}}}\right), \quad b>0 $$

I ended with

$$ \int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\,\mathrm{erfc}\left(t-c\right)\,\mathrm{erfc}\left(d-t\right)\,\mathrm{d}t= $$

$$ =2\int_{\frac{1}{\sqrt{2}}\left(d-c\right)}^{\infty}\exp\left(-y^{2}\right)\left[\mathrm{erf}\left(\frac{1}{\sqrt{3}}\left(y+\sqrt{2}c\right)\right)+\mathrm{erf}\left(\frac{1}{\sqrt{3}}\left(y-\sqrt{2}d\right)\right)\right]\,\mathrm{d}y. $$

I checked it numerically and it's correct!

The last thing I need to do is to find an evaluation of a general integral $$ \int_{z}^{\infty}\exp\left(-y^{2}\right)\mathrm{erf}\left(m\left(y-n\right)\right)\,\mathrm{d}y. $$

but unfortunately I don't know how.

EDIT

And incidentally

$$ \int_{-\infty}^{\infty}\exp\left(-t^{2}\right)\,\mathrm{erfc}\left(t-c\right)\,\mathrm{erfc}\left(d-t\right)\,\mathrm{d}t= $$ $$ =2\int_{\frac{1}{\sqrt{2}}\left(d-c\right)}^{\infty}\exp\left(-y^{2}\right)\left[\mathrm{erf}\left(\frac{1}{\sqrt{3}}\left(y+\sqrt{2}c\right)\right)+\mathrm{erf}\left(\frac{1}{\sqrt{3}}\left(y-\sqrt{2}d\right)\right)\right]\,\mathrm{d}y = $$ $$ = -2\int_{-\infty}^{\frac{1}{\sqrt{2}}\left(c-d\right)}\exp\left(-y^{2}\right)\left[\mathrm{erf}\left(\frac{1}{\sqrt{3}}\left(y-\sqrt{2}c\right)\right)+\mathrm{erf}\left(\frac{1}{\sqrt{3}}\left(y+\sqrt{2}d\right)\right)\right]\mathrm{d}y= $$ $$ {\small = 2\int_{0}^{\infty}\exp\!\left(-\left(y-\frac{1}{\sqrt{2}}\left(c-d\right)\right)^{2}\right)\left[\mathrm{erf}\!\left(\frac{1}{\sqrt{3}}\left(y+\frac{1}{\sqrt{2}}\left(c+d\right)\right)\right)+\mathrm{erf}\!\left(\frac{1}{\sqrt{3}}\left(y-\frac{1}{\sqrt{2}}\left(c+d\right)\right)\right)\right]\mathrm{d}y } $$

$$ {\small = -2\int_{-\infty}^{0}\exp\!\left(-\left(y+\frac{1}{\sqrt{2}}\left(c-d\right)\right)^{2}\right)\left[\mathrm{erf}\!\left(\frac{1}{\sqrt{3}}\left(y+\frac{1}{\sqrt{2}}\left(c+d\right)\right)\right)+\mathrm{erf}\!\left(\frac{1}{\sqrt{3}}\left(y-\frac{1}{\sqrt{2}}\left(c+d\right)\right)\right)\right]\mathrm{d}y. } $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.