# Closed forms for definite integrals involving error functions

I have been working for a while with these kinds of integrals

$$\int_0^\infty dx\,\text{erfc}\left(c +i x\right)\exp \left(-\frac{1}{2}d^2x^2+i cx\right)$$ $$\int_\Lambda^\infty dx\,\frac{1}{x}\text{erfc}\left(c +i x\right) \exp \left(-\frac{1}{2}d^2x^2+i cx\right)$$ where $c$ and $d$ are just real constants and $\Lambda>0$.

I have also been working with other similar integrals that have a closed-form expression, but I can't figure out the form of these ones. Does anyone know if these integrals have a closed-form solution?

• Hint: Replace $\text{erfc}(\color{red}c+ix)$ with $\text{erfc}(\color{red}u+ix)$, then differentiate both expressions with regard to u, and the second one also with regard to c. – Lucian May 17 '15 at 2:19

First of all for both integrals to exist we need $$d> \sqrt{2}$$ or otherwise the integral is divergent around plus infinity. Now the first integral has a closed form in terms of the Owen's T function as shown below: $$\begin{eqnarray} &&\int\limits_0^\infty \operatorname{erfc}(c+ \imath x) \exp(-\frac{1}{2} d^2 x^2+\imath c x) dx=\\ && \exp(-\frac{1}{2} \frac{c^2}{d^2} ) \frac{\sqrt{2\pi}}{d} \int\limits_{-\imath \frac{c}{d}}^\infty \operatorname{erfc}(c-\frac{c}{d^2}+\imath \frac{x}{d}) \frac{\exp(-1/2 x^2)}{\sqrt{2 \pi}} dx=\\ && \exp(-\frac{1}{2} \frac{c^2}{d^2} ) \frac{\sqrt{2\pi}}{d} \left( \frac{1}{2} \operatorname{erfc}(-\imath \frac{c}{\sqrt{2} d}) - 2 T(-\imath \frac{c}{d}, \imath\frac{\sqrt{2}}{d},(c-\frac{c}{d^2})\sqrt{2})\right)=\\ &&- \frac{\exp(-\frac{1}{2} \frac{c^2}{d^2} )}{\sqrt{2 \pi}d} \left( 4 \pi T\left(\frac{c-\frac{c}{d^2}}{\sqrt{\frac{1}{2}-\frac{1}{d^2}}},\frac{i d}{\sqrt{2} \left(d^2-1\right)}\right)+4 \pi T\left(\frac{i c}{d},i \sqrt{2} d\right)+\pi \operatorname{erf}\left(\frac{c-\frac{c}{d^2}}{\sqrt{1-\frac{2}{d^2}}}\right)-\pi \operatorname{erfc}\left(-\frac{i c}{\sqrt{2} d}\right)-2 i \tanh^{-1}\left(\frac{d}{\sqrt{2} \left(d^2-1\right)}\right)+2 i \tanh ^{-1}\left(\frac{\sqrt{2}}{d}\right)-2 i \tanh ^{-1}\left(\sqrt{2} d\right) \right) \end{eqnarray}$$ where $$T(h,a)$$ is the Owen's T function and $$T(h,a,b)$$ is the generalized Owen's T function (see Generalized Owen's T function).

In[1201]:= {d} = RandomReal[{Sqrt[2], 2}, 1, WorkingPrecision -> 50];
{c} = RandomReal[{0, 2}, 1, WorkingPrecision -> 50];
NIntegrate[ Erfc[c + I x] Exp[-1/2 d^2 x^2 + I c x], {x, 0, Infinity}]
NIntegrate[
Erfc[c + I Sqrt[2]/d x] Exp[- x^2 + I c Sqrt[2]/d x], {x, 0,
Infinity}] Sqrt[2]/d
Exp[-1/2 c^2/d^2] 1/d NIntegrate[
Erfc[c - c/d^2 + (I  x)/d] Exp[-1/2 (x)^2], {x, -I c /(d) ,
Infinity}]
Exp[-1/2 c^2/d^2] 1/d Sqrt[
2 Pi] (1/2 Erfc[-I c /(d) 1/Sqrt[2]] -
2 T[-I c /(d), I/d Sqrt[2], (c - c/d^2) Sqrt[2]])
-Exp[-1/2 c^2/d^2] 1/(d Sqrt[2 Pi]) (2 I ArcTanh[Sqrt[2]/d] -
2 I ArcTanh[Sqrt[2] d] -
2 I ArcTanh[d/(Sqrt[2] (-1 + d^2))] + \[Pi] Erf[(c - c/d^2)/Sqrt[
1 - 2/d^2]] - \[Pi] Erfc[-((I c)/(Sqrt[2] d))] +
4 \[Pi] OwenT[(c - c/d^2)/Sqrt[1/2 - 1/d^2], (I d)/(
Sqrt[2] (-1 + d^2))] + 4 \[Pi] OwenT[(I c)/d, I Sqrt[2] d])

Out[1203]= 0.0185396 - 0.0478548 I

Out[1204]= 0.0185396 - 0.0478548 I

Out[1205]= 0.0185396 - 0.0478548 I

Out[1206]= 0.018539649231816650876610218020057720732515452423 -
0.047854753638600728058690767430930302821895582282 I

Out[1207]= 0.018539649231816650876610218020057720732515452423 -
0.0478547536386007280586907674309303028218955822824 I


If $u =\operatorname{erfc}(c+ix)$ then

$$du = \dfrac {-2} {\sqrt\pi} e^{-(c+ix)^2} i \, dx = \dfrac {-2} {\sqrt\pi} e^{-(c^2-2icx - x^2)^2} i \, dx. \tag 1$$

We need to work with $$\exp\left( \frac {-1}2 d^2x^2 + icx\right).$$ The exponent is $$\frac{-d^2} 2 \left( x^2 - \frac{2icx}{d^2} - \frac{c^2}{d^4} \right) - \frac{c^2}{2d^2} = \frac{-d^2}2\left( x - \frac{ic}{d^2} \right)^2 - \frac{c^2}{2d^2} = \frac{-d^2}2 w^2 - \frac{c^2}{2d^2}.$$

Where we find $x$ in $(1)$, replace it with $$x = w + \frac{ic}{d^2}.$$ Then do routine algebra and go on from there.

• i think there is a typo in yout dirst line... – tired May 16 '15 at 21:48
• @tired : Thank you. I've fixed it now, I how. – Michael Hardy May 16 '15 at 22:47
• Thank you for your answer. However, I don't follow how you obtain $x=u+i\frac{c}{d^2}$ from $u=\text{erfc}(c+ix)$, or maybe you are saying to perform two different changes of variables? Additionally there is still a typo in $(1)$, the last exponential should be $e^{-(c^2+2icx-x^2)}$ right? – Alex May 16 '15 at 23:27
• Sorry -- I did intend two different ones. I've changed ti. – Michael Hardy May 17 '15 at 1:25
• @MichaelHardy, I have been trying to follow your steps, and I have arrived to the following expression for the first one $$\frac{i\sqrt{\pi}}{2}e^{(d^2/2-1)c^2}\int_{\text{erfc}(c)}^0 du\,u\, e^{(d^2/2+1)[\text{erfc}^{-1}(u)]^2-c(d^2+1)\text{erfc}^{-1}(u)}.$$I have tried integrating by parts since the integral of the whole exponential has an analytic expression, but I haven't succeeded in getting a final result. Am I in the right track? – Alex May 20 '15 at 4:04