\(\int (c+d x) \text {erf}(a+b x)^2 \, dx\) [36]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 14, antiderivative size = 188 \[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=\frac {d e^{-2 (a+b x)^2}}{2 b^2 \pi }+\frac {2 (b c-a d) e^{-(a+b x)^2} \text {erf}(a+b x)}{b^2 \sqrt {\pi }}+\frac {d e^{-(a+b x)^2} (a+b x) \text {erf}(a+b x)}{b^2 \sqrt {\pi }}-\frac {d \text {erf}(a+b x)^2}{4 b^2}+\frac {(b c-a d) (a+b x) \text {erf}(a+b x)^2}{b^2}+\frac {d (a+b x)^2 \text {erf}(a+b x)^2}{2 b^2}-\frac {(b c-a d) \sqrt {\frac {2}{\pi }} \text {erf}\left (\sqrt {2} (a+b x)\right )}{b^2} \]

[Out]

1/2*d/b^2/exp(2*(b*x+a)^2)/Pi-1/4*d*erf(b*x+a)^2/b^2+(-a*d+b*c)*(b*x+a)*erf(b*x+a)^2/b^2+1/2*d*(b*x+a)^2*erf(b
*x+a)^2/b^2-(-a*d+b*c)*erf((b*x+a)*2^(1/2))*2^(1/2)/Pi^(1/2)/b^2+2*(-a*d+b*c)*erf(b*x+a)/b^2/exp((b*x+a)^2)/Pi
^(1/2)+d*(b*x+a)*erf(b*x+a)/b^2/exp((b*x+a)^2)/Pi^(1/2)

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 188, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.643, Rules used = {6502, 6487, 6517, 2236, 6499, 6520, 6508, 30, 2240} \[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=\frac {(a+b x) (b c-a d) \text {erf}(a+b x)^2}{b^2}+\frac {2 e^{-(a+b x)^2} (b c-a d) \text {erf}(a+b x)}{\sqrt {\pi } b^2}-\frac {\sqrt {\frac {2}{\pi }} (b c-a d) \text {erf}\left (\sqrt {2} (a+b x)\right )}{b^2}+\frac {d (a+b x)^2 \text {erf}(a+b x)^2}{2 b^2}-\frac {d \text {erf}(a+b x)^2}{4 b^2}+\frac {d e^{-(a+b x)^2} (a+b x) \text {erf}(a+b x)}{\sqrt {\pi } b^2}+\frac {d e^{-2 (a+b x)^2}}{2 \pi b^2} \]

[In]

Int[(c + d*x)*Erf[a + b*x]^2,x]

[Out]

d/(2*b^2*E^(2*(a + b*x)^2)*Pi) + (2*(b*c - a*d)*Erf[a + b*x])/(b^2*E^(a + b*x)^2*Sqrt[Pi]) + (d*(a + b*x)*Erf[
a + b*x])/(b^2*E^(a + b*x)^2*Sqrt[Pi]) - (d*Erf[a + b*x]^2)/(4*b^2) + ((b*c - a*d)*(a + b*x)*Erf[a + b*x]^2)/b
^2 + (d*(a + b*x)^2*Erf[a + b*x]^2)/(2*b^2) - ((b*c - a*d)*Sqrt[2/Pi]*Erf[Sqrt[2]*(a + b*x)])/b^2

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2236

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^2), x_Symbol] :> Simp[F^a*Sqrt[Pi]*(Erf[(c + d*x)*Rt[(-b)*Log[F],
 2]]/(2*d*Rt[(-b)*Log[F], 2])), x] /; FreeQ[{F, a, b, c, d}, x] && NegQ[b]

Rule 2240

Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*((e_.) + (f_.)*(x_))^(m_.), x_Symbol] :> Simp[(e + f*x)^n*(
F^(a + b*(c + d*x)^n)/(b*f*n*(c + d*x)^n*Log[F])), x] /; FreeQ[{F, a, b, c, d, e, f, n}, x] && EqQ[m, n - 1] &
& EqQ[d*e - c*f, 0]

Rule 6487

Int[Erf[(a_.) + (b_.)*(x_)]^2, x_Symbol] :> Simp[(a + b*x)*(Erf[a + b*x]^2/b), x] - Dist[4/Sqrt[Pi], Int[(a +
b*x)*(Erf[a + b*x]/E^(a + b*x)^2), x], x] /; FreeQ[{a, b}, x]

Rule 6499

Int[Erf[(b_.)*(x_)]^2*(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)*(Erf[b*x]^2/(m + 1)), x] - Dist[4*(b/(Sqrt[Pi]*(
m + 1))), Int[(x^(m + 1)*Erf[b*x])/E^(b^2*x^2), x], x] /; FreeQ[b, x] && (IGtQ[m, 0] || ILtQ[(m + 1)/2, 0])

Rule 6502

Int[Erf[(a_) + (b_.)*(x_)]^2*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Dist[1/b^(m + 1), Subst[Int[ExpandIntegr
and[Erf[x]^2, (b*c - a*d + d*x)^m, x], x], x, a + b*x], x] /; FreeQ[{a, b, c, d}, x] && IGtQ[m, 0]

Rule 6508

Int[E^((c_.) + (d_.)*(x_)^2)*Erf[(b_.)*(x_)]^(n_.), x_Symbol] :> Dist[E^c*(Sqrt[Pi]/(2*b)), Subst[Int[x^n, x],
 x, Erf[b*x]], x] /; FreeQ[{b, c, d, n}, x] && EqQ[d, -b^2]

Rule 6517

Int[E^((c_.) + (d_.)*(x_)^2)*Erf[(a_.) + (b_.)*(x_)]*(x_), x_Symbol] :> Simp[E^(c + d*x^2)*(Erf[a + b*x]/(2*d)
), x] - Dist[b/(d*Sqrt[Pi]), Int[E^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2), x], x] /; FreeQ[{a, b, c, d}, x]

Rule 6520

Int[E^((c_.) + (d_.)*(x_)^2)*Erf[(a_.) + (b_.)*(x_)]*(x_)^(m_), x_Symbol] :> Simp[x^(m - 1)*E^(c + d*x^2)*(Erf
[a + b*x]/(2*d)), x] + (-Dist[(m - 1)/(2*d), Int[x^(m - 2)*E^(c + d*x^2)*Erf[a + b*x], x], x] - Dist[b/(d*Sqrt
[Pi]), Int[x^(m - 1)*E^(-a^2 + c - 2*a*b*x - (b^2 - d)*x^2), x], x]) /; FreeQ[{a, b, c, d}, x] && IGtQ[m, 1]

Rubi steps \begin{align*} \text {integral}& = \frac {\text {Subst}\left (\int \left (b c \left (1-\frac {a d}{b c}\right ) \text {erf}(x)^2+d x \text {erf}(x)^2\right ) \, dx,x,a+b x\right )}{b^2} \\ & = \frac {d \text {Subst}\left (\int x \text {erf}(x)^2 \, dx,x,a+b x\right )}{b^2}+\frac {(b c-a d) \text {Subst}\left (\int \text {erf}(x)^2 \, dx,x,a+b x\right )}{b^2} \\ & = \frac {(b c-a d) (a+b x) \text {erf}(a+b x)^2}{b^2}+\frac {d (a+b x)^2 \text {erf}(a+b x)^2}{2 b^2}-\frac {(2 d) \text {Subst}\left (\int e^{-x^2} x^2 \text {erf}(x) \, dx,x,a+b x\right )}{b^2 \sqrt {\pi }}-\frac {(4 (b c-a d)) \text {Subst}\left (\int e^{-x^2} x \text {erf}(x) \, dx,x,a+b x\right )}{b^2 \sqrt {\pi }} \\ & = \frac {2 (b c-a d) e^{-(a+b x)^2} \text {erf}(a+b x)}{b^2 \sqrt {\pi }}+\frac {d e^{-(a+b x)^2} (a+b x) \text {erf}(a+b x)}{b^2 \sqrt {\pi }}+\frac {(b c-a d) (a+b x) \text {erf}(a+b x)^2}{b^2}+\frac {d (a+b x)^2 \text {erf}(a+b x)^2}{2 b^2}-\frac {(2 d) \text {Subst}\left (\int e^{-2 x^2} x \, dx,x,a+b x\right )}{b^2 \pi }-\frac {(4 (b c-a d)) \text {Subst}\left (\int e^{-2 x^2} \, dx,x,a+b x\right )}{b^2 \pi }-\frac {d \text {Subst}\left (\int e^{-x^2} \text {erf}(x) \, dx,x,a+b x\right )}{b^2 \sqrt {\pi }} \\ & = \frac {d e^{-2 (a+b x)^2}}{2 b^2 \pi }+\frac {2 (b c-a d) e^{-(a+b x)^2} \text {erf}(a+b x)}{b^2 \sqrt {\pi }}+\frac {d e^{-(a+b x)^2} (a+b x) \text {erf}(a+b x)}{b^2 \sqrt {\pi }}+\frac {(b c-a d) (a+b x) \text {erf}(a+b x)^2}{b^2}+\frac {d (a+b x)^2 \text {erf}(a+b x)^2}{2 b^2}-\frac {(b c-a d) \sqrt {\frac {2}{\pi }} \text {erf}\left (\sqrt {2} (a+b x)\right )}{b^2}-\frac {d \text {Subst}(\int x \, dx,x,\text {erf}(a+b x))}{2 b^2} \\ & = \frac {d e^{-2 (a+b x)^2}}{2 b^2 \pi }+\frac {2 (b c-a d) e^{-(a+b x)^2} \text {erf}(a+b x)}{b^2 \sqrt {\pi }}+\frac {d e^{-(a+b x)^2} (a+b x) \text {erf}(a+b x)}{b^2 \sqrt {\pi }}-\frac {d \text {erf}(a+b x)^2}{4 b^2}+\frac {(b c-a d) (a+b x) \text {erf}(a+b x)^2}{b^2}+\frac {d (a+b x)^2 \text {erf}(a+b x)^2}{2 b^2}-\frac {(b c-a d) \sqrt {\frac {2}{\pi }} \text {erf}\left (\sqrt {2} (a+b x)\right )}{b^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.29 (sec) , antiderivative size = 132, normalized size of antiderivative = 0.70 \[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=\frac {2 d e^{-2 (a+b x)^2}+4 e^{-(a+b x)^2} \sqrt {\pi } (2 b c-a d+b d x) \text {erf}(a+b x)+\pi \left (4 a b c-d-2 a^2 d+4 b^2 c x+2 b^2 d x^2\right ) \text {erf}(a+b x)^2+4 (-b c+a d) \sqrt {2 \pi } \text {erf}\left (\sqrt {2} (a+b x)\right )}{4 b^2 \pi } \]

[In]

Integrate[(c + d*x)*Erf[a + b*x]^2,x]

[Out]

((2*d)/E^(2*(a + b*x)^2) + (4*Sqrt[Pi]*(2*b*c - a*d + b*d*x)*Erf[a + b*x])/E^(a + b*x)^2 + Pi*(4*a*b*c - d - 2
*a^2*d + 4*b^2*c*x + 2*b^2*d*x^2)*Erf[a + b*x]^2 + 4*(-(b*c) + a*d)*Sqrt[2*Pi]*Erf[Sqrt[2]*(a + b*x)])/(4*b^2*
Pi)

Maple [F]

\[\int \left (d x +c \right ) \operatorname {erf}\left (b x +a \right )^{2}d x\]

[In]

int((d*x+c)*erf(b*x+a)^2,x)

[Out]

int((d*x+c)*erf(b*x+a)^2,x)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 171, normalized size of antiderivative = 0.91 \[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=-\frac {4 \, \sqrt {2} \sqrt {\pi } \sqrt {b^{2}} {\left (b c - a d\right )} \operatorname {erf}\left (\frac {\sqrt {2} \sqrt {b^{2}} {\left (b x + a\right )}}{b}\right ) - 4 \, \sqrt {\pi } {\left (b^{2} d x + 2 \, b^{2} c - a b d\right )} \operatorname {erf}\left (b x + a\right ) e^{\left (-b^{2} x^{2} - 2 \, a b x - a^{2}\right )} - {\left (2 \, \pi b^{3} d x^{2} + 4 \, \pi b^{3} c x + \pi {\left (4 \, a b^{2} c - {\left (2 \, a^{2} + 1\right )} b d\right )}\right )} \operatorname {erf}\left (b x + a\right )^{2} - 2 \, b d e^{\left (-2 \, b^{2} x^{2} - 4 \, a b x - 2 \, a^{2}\right )}}{4 \, \pi b^{3}} \]

[In]

integrate((d*x+c)*erf(b*x+a)^2,x, algorithm="fricas")

[Out]

-1/4*(4*sqrt(2)*sqrt(pi)*sqrt(b^2)*(b*c - a*d)*erf(sqrt(2)*sqrt(b^2)*(b*x + a)/b) - 4*sqrt(pi)*(b^2*d*x + 2*b^
2*c - a*b*d)*erf(b*x + a)*e^(-b^2*x^2 - 2*a*b*x - a^2) - (2*pi*b^3*d*x^2 + 4*pi*b^3*c*x + pi*(4*a*b^2*c - (2*a
^2 + 1)*b*d))*erf(b*x + a)^2 - 2*b*d*e^(-2*b^2*x^2 - 4*a*b*x - 2*a^2))/(pi*b^3)

Sympy [F]

\[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=\int \left (c + d x\right ) \operatorname {erf}^{2}{\left (a + b x \right )}\, dx \]

[In]

integrate((d*x+c)*erf(b*x+a)**2,x)

[Out]

Integral((c + d*x)*erf(a + b*x)**2, x)

Maxima [F]

\[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=\int { {\left (d x + c\right )} \operatorname {erf}\left (b x + a\right )^{2} \,d x } \]

[In]

integrate((d*x+c)*erf(b*x+a)^2,x, algorithm="maxima")

[Out]

1/2*(d*x^2 + 2*c*x)*erf(b*x + a)^2 - integrate(2*(b*d*x^2 + 2*b*c*x)*erf(b*x + a)*e^(-b^2*x^2 - 2*a*b*x - a^2)
, x)/sqrt(pi)

Giac [F]

\[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=\int { {\left (d x + c\right )} \operatorname {erf}\left (b x + a\right )^{2} \,d x } \]

[In]

integrate((d*x+c)*erf(b*x+a)^2,x, algorithm="giac")

[Out]

integrate((d*x + c)*erf(b*x + a)^2, x)

Mupad [B] (verification not implemented)

Time = 0.42 (sec) , antiderivative size = 186, normalized size of antiderivative = 0.99 \[ \int (c+d x) \text {erf}(a+b x)^2 \, dx=\frac {d\,x^2\,{\mathrm {erf}\left (a+b\,x\right )}^2}{2}-\frac {{\mathrm {erf}\left (a+b\,x\right )}^2\,\left (2\,d\,a^2-4\,b\,c\,a+d\right )}{4\,b^2}+c\,x\,{\mathrm {erf}\left (a+b\,x\right )}^2+\frac {d\,{\mathrm {e}}^{-2\,a^2-4\,a\,b\,x-2\,b^2\,x^2}}{2\,b^2\,\pi }-\frac {\mathrm {erf}\left (a+b\,x\right )\,{\mathrm {e}}^{-a^2-2\,a\,b\,x-b^2\,x^2}\,\left (a\,d-2\,b\,c\right )}{b^2\,\sqrt {\pi }}+\frac {\sqrt {2}\,\mathrm {erf}\left (\sqrt {2}\,\left (a+b\,x\right )\right )\,\left (a\,d-b\,c\right )}{b^2\,\sqrt {\pi }}+\frac {d\,x\,\mathrm {erf}\left (a+b\,x\right )\,{\mathrm {e}}^{-a^2-2\,a\,b\,x-b^2\,x^2}}{b\,\sqrt {\pi }} \]

[In]

int(erf(a + b*x)^2*(c + d*x),x)

[Out]

(d*x^2*erf(a + b*x)^2)/2 - (erf(a + b*x)^2*(d + 2*a^2*d - 4*a*b*c))/(4*b^2) + c*x*erf(a + b*x)^2 + (d*exp(- 2*
a^2 - 2*b^2*x^2 - 4*a*b*x))/(2*b^2*pi) - (erf(a + b*x)*exp(- a^2 - b^2*x^2 - 2*a*b*x)*(a*d - 2*b*c))/(b^2*pi^(
1/2)) + (2^(1/2)*erf(2^(1/2)*(a + b*x))*(a*d - b*c))/(b^2*pi^(1/2)) + (d*x*erf(a + b*x)*exp(- a^2 - b^2*x^2 -
2*a*b*x))/(b*pi^(1/2))