# Integrating a product of a Gaussian and an arc tangent

There were already several questions dealing with integrals involving a Gaussian and some other function.

Integrating Gaussians with rational functions is dealt with in here:

Gaussians with error functions are dealt with in here:

and finally Gaussians with a logarithm in here:

I thought it might be useful to expand on this topic and integrate a Gaussian with and arc tangent. To be specific let us take $$a\ge 0$$, $$b \ge0$$, $$w\ge 0$$ and $$h \ge w/2$$ and consider a following quantity: $$$${\mathfrak J}^{(w)}_h(a,b):= \int\limits_h^\infty \arctan(a+b \xi) \cdot \exp(-\xi^2+w \xi) d\xi \quad (i)$$$$

Now by differentiating the above with respect to $$a$$ we get: $$$$f(w):= \partial_a {\mathfrak J}^{(w)}_h(a,b) = \int\limits_h^\infty \frac{\exp(-\xi^2+w \xi)}{1+a^2+2 a b \xi + b^2 \xi^2} d\xi$$$$ and then we observe that the quantity above solves the following ODE: $$$$\left[ (1+a^2) + 2 a b \partial_w + b^2 \partial^2_w \right] f(w) = \frac{\sqrt{\pi}}{2} e^{\frac{w^2}{4}} \left(1+erf[\frac{w}{2} - h]\right)$$$$ subject to $$f(-\infty)=f^{'}(-\infty)=0$$. Now by solving the above ODE by means of the Greens function method General Solution of a Differential Equation using Green's Function and then by using Generalized Owen's T function we got the following result: $$\begin{eqnarray} &&\partial_a {\mathfrak J}^{(w)}_h(a,b)=-\frac{1}{2 b} \left( \right.\\ && \pi e^{\frac{-a^2-a b w+1}{b^2}} \cos \left(\frac{2 a+b w}{b^2}\right) + \\ && \frac{1}{2} \pi \text{erfc}\left(h-\frac{w}{2}\right) \left(e^{-\frac{(a+i) (a+b w+i)}{b^2}} \text{erf}\left(\frac{-2 i a-i b w+2}{2 b}\right)+e^{-\frac{(a-i) (a+b w-i)}{b^2}} \text{erf}\left(\frac{2 i a+i b w+2}{2 b}\right)\right)+\\ && \mbox{Im}\left[e^{-\frac{(a-i) (a+b w-i)}{b^2}} \left(\text{Ei}\left(\frac{(a+b h-i) (a-b h+b w-i)}{b^2}\right)-4 i \pi T\left(\sqrt{2} \left(h-\frac{w}{2}\right),\frac{2 i a+i b w+2}{2 b h-b w}\right)\right)\right]\\ && \left. \right) \end{eqnarray}$$ where $$Ei()$$ is the exponential integral and $$T(\cdot,\cdot)$$ is the Owen's T function. The Mathematica code below shows the steps in the derivation:

In[1154]:= {b, w} = RandomReal[{0, 2}, 2, WorkingPrecision -> 50];
h = RandomReal[{w/2, 2}, WorkingPrecision -> 50];
a = Range[0, 2, 0.01];
f = Interpolation[
Transpose[{a,
NIntegrate[ArcTan[# + b z] Exp[-z^2 + w z], {z, h, Infinity}] & /@
a}]];

a = RandomReal[{0, 2}, WorkingPrecision -> 50];
f'[a]
NIntegrate[Exp[-x^2 + w x]/(
1 + a^2 + 2 a b x + b^2 x^2), {x, h, Infinity}]
{thp, thm} = -a/b + I {1/b, -1/b};
Sqrt[Pi]/ b E^(-((2 a w)/b))
Im[ Exp[-((-I + a)^2/b^2) + ((I + a) w)/b] NIntegrate[
Exp[(xi)^2 ] Erfc[xi + h - (I - a)/b], {xi, -w/2 + (I - a)/b,
Infinity}, Method -> "GaussKronrodRule", WorkingPrecision -> 15]]
Sqrt[Pi]/ b E^(-((2 a w)/b))
Im[ Exp[-((-I + a)^2/b^2) + ((I + a) w)/
b] (-(1/2) Sqrt[\[Pi]] Erfc[h - w/2] Erfi[(I - a)/b - w/2] -
I Sqrt[Pi] NIntegrate[
Erf[I xi/Sqrt[2] + I (I - a)/b - I h]  (E^(-1/2 (+xi)^2))/Sqrt[
2 Pi], {xi, (-w/2 + h) Sqrt[2], Infinity},
Method -> "GaussKronrodRule", WorkingPrecision -> 15])]
Sqrt[Pi]/ b E^(-((2 a w)/b))
Im[ Exp[-((-I + a)^2/b^2) + ((I + a) w)/
b] (-(1/2) Sqrt[\[Pi]] Erfc[h - w/2] Erfi[(I - a)/b - w/2] -
I Sqrt[Pi] NIntegrate[
Erf[( I xi + Sqrt[2] (-1/b - I (a/b + h)))/Sqrt[
2]] E^(-1/2 (xi)^2)/Sqrt[2 Pi], {xi, (-w/2 + h) Sqrt[2],
Infinity}, Method -> "GaussKronrodRule",
WorkingPrecision -> 15])]

-1/(2 b) (E^((1 - a^2 - a b w)/
b^2) \[Pi] Cos[(2 a + b w)/b^2] +  \[Pi] /
2 (E^(-(((-I + a) (-I + a + b w))/b^2))
Erf[(2 + 2 I a + I b w)/(2 b)] +
E^(-(((I + a) (I + a + b w))/b^2))
Erf[(2 - 2 I a - I b w)/(2 b)]) Erfc[h - w/2] +
Im[ E^(-(((-I + a) (-I + a + b w))/
b^2)) (ExpIntegralEi[((-I + a + b h) (-I + a - b h + b w))/
b^2] - 4 I \[Pi] OwenT[Sqrt[2] (h - w/2), (
2 + 2 I a + I b w)/(2 b h - b w)])])

Out[1159]= 0.0856681

Out[1160]= 0.0856681

Out[1162]= 0.085668129862951

Out[1163]= 0.085668129855779

Out[1164]= 0.085668129855779

Out[1165]= 0.08566812985579264812636053092219527670978903468 +
0.*10^-48 I


now , my question would be can we actually integrate the result above in order to get a closed form expression for the original integral $$(i)$$.

• Wolfram Alpha says no. – Yves Daoust Mar 28 at 13:56