# Closed form for a family of definite integrals involving a Gaussian and error functions.

Let $$n\ge 0$$ be an integer and let $$c \in {\mathbb R}$$. Let us define:

$$\begin{eqnarray} {\mathfrak F}^{(A,B)}_{a,b} &:=& \int\limits_A^B \frac{\log(z+a)}{z+b} dz\\ &=& F[B,a,b] - F[A,a,b] + 1_{t^* \in (0,1)} \left( -F[A+(t^*+\epsilon)(B-A),a,b] + F[A+(t^*-\epsilon)(B-A),a,b] \right) \end{eqnarray}$$ where $$\begin{eqnarray} t^*:=-\frac{Im[(A+b)(b^*-a^*)]}{Im[(B-A)(b^*-a^*)]} \end{eqnarray}$$ and $$$$F[z,a,b] := \log(z+a) \log\left( \frac{z+b}{b-a}\right) + Li_2\left( \frac{z+a}{a-b}\right)$$$$ for $$a$$,$$b$$,$$A$$,$$B$$ being complex.

Now, consider the following quantity: $$$${\mathcal I}^{(n)}(c):= \int\limits_0^\infty \text{erf}(c x) \cdot [\text{erf}(x)]^n \cdot e^{-x^2} dx$$$$ By generalizing the approach outlined in my answer to Closed form for $\int_{0}^{\infty }\!{\rm erf} \left(cx\right) \left( {\rm erf} \left(x \right) \right) ^{2}{{\rm e}^{-{x}^{2}}}\,{\rm d}x$ we found the following results: $$\begin{eqnarray} &&{\mathcal I}^{(2)}(c)= \frac{4}{\pi^{3/2}}\left(\right.\\ &&\left. \arctan\left(\frac{1}{\sqrt{c^2+2}}\right) \arctan\left(\frac{c}{\sqrt{c^2+2}}\right)+\right.\\ &&\left. \frac{1}{4} \sum\limits_{i=1}^4 \sum\limits_{j=1}^4 (-1)^{\left\lfloor \frac{i-1}{2}\right\rfloor +i+j-2} {\mathfrak F}^{(0,\frac{\sqrt{c^2+2}-\sqrt{2}}{c})}_{i (-1)^{i-1} \left((-1)^{\left\lfloor \frac{i-1}{2}\right\rfloor }+\sqrt{2}\right),-(-1)^{\left\lfloor \frac{j-1}{2}\right\rfloor } e^{i (-1)^j \arccos\left(\frac{1}{\sqrt{3}}\right)}}\right.\\ &&\left. \right) \end{eqnarray}$$ Likewise $$\begin{eqnarray} &&{\mathcal I}^{(3)}(c)= \frac{6}{\pi^{3/2}}\left(\right.\\ &&\left. \arctan\left(\frac{c}{\sqrt{c^2+2}}\right) \arctan\left(\frac{1}{\sqrt{\left(c^2+2\right) \left(c^2+4\right)}}\right) \right. \\ &&\left. \frac{1}{2} \sum\limits_{i=1}^4 \sum\limits_{j=1}^4 (-1)^{\left\lfloor \frac{i-1}{2}\right\rfloor +\left\lfloor \frac{j-1}{2}\right\rfloor +1} {\mathfrak F}^{(0,\frac{\sqrt{2} \sqrt{c^2+2}-\sqrt{c^2+4}}{c})}_{i \left(\sqrt{2} (-1)^{\left\lfloor \frac{i-1}{2}\right\rfloor }+\sqrt{3} (-1)^i\right),(-1)^{j-1} \sqrt{\frac{1}{3}+\frac{2}{3} i \sqrt{2} (-1)^{\left\lfloor \frac{j-1}{2}\right\rfloor }}}\right.\\ &&\left. \right) \end{eqnarray}$$

(*Definitions*)

Clear[F]; Clear[FF];
F[z_, a_, b_] :=
Log[a + z] Log[(b + z)/(-a + b)] + PolyLog[2, (a + z)/(a - b)];
FF[A_, B_, a_, b_] :=
Module[{result, ts, zs, zsp, zsm, eps = 10^(-15)},
(*This is Integrate[Log[z+a]/(z+b),{z,A,B}] where all a,b,A,
and B are complex. *)
result = F[B, a, b] - F[A, a, b];

ts = - (Im[(A + b) (Conjugate[b] - Conjugate[a])]/
Im[(B - A) (Conjugate[b] - Conjugate[a])]);
If[0 <= ts <= 1,
zsp = A + (ts + eps) (B - A);
zsm = A + (ts - eps) (B - A);
result += -F[zsp, a, b] + F[zsm, a, b];
];

result
];

For[count = 1, count <= 10, count++,
c = RandomReal[{-10, 10}, WorkingPrecision -> 50];
x1 = NIntegrate[Erf[c x] Erf[x]^2 Exp[-x^2], {x, 0, Infinity},
WorkingPrecision -> 30];
x11 = 4/Pi^(
3/2) (ArcTan[c/Sqrt[2 + c^2]] ArcTan[1 /Sqrt[2 + c^2]] +
1/4 Sum[(-1)^(i - 1 + Floor[(i - 1)/2]) (-1)^(j - 1)
FF[0, (-Sqrt[2] + Sqrt[2 + c^2])/
c, (-1)^(i - 1)
I (Sqrt[2] + (-1)^Floor[(i - 1)/2] 1), -(-1)^
Floor[(j - 1)/2] E^((-1)^j I ArcCos[1/Sqrt[3]])], {i, 1,
4}, {j, 1, 4}]);
If[Abs[x11/x1 - 1] > 10^(-3),
Print["results 1 do not match..", c, {x1, x11}]; Break[]];

x2 = NIntegrate[Erf[c x] Erf[x]^3 Exp[-x^2], {x, 0, Infinity},
WorkingPrecision -> 30];

x21 = 6/Pi^(
3/2) (ArcTan[c/Sqrt[2 + c^2]] ArcTan[1/
Sqrt[(2 + c^2) (4 + c^2)]] +
1/2 Sum[(-1)^Floor[(i - 1)/2] (-1)^(1 + Floor[(j - 1)/2])
FF[0,  (Sqrt[2] Sqrt[2 + c^2] - Sqrt[4 + c^2])/
c, +I ((-1)^Floor[(i - 1)/2] Sqrt[2] + (-1)^i Sqrt[
3]), (-1)^(j - 1) Sqrt[
1/3 + (-1)^Floor[(j - 1)/2] (2 I Sqrt[2])/3]], {i, 1,
4}, {j, 1, 4}]);

If[Abs[x21/x2 - 1] > 10^(-3),
Print["results 2 do not match..", c, {x1, x11}]; Break[]];
If[Mod[count, 1] == 0, PrintTemporary[count]];
];


Now my question is what are the results for $$n>3$$ ?