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

3.1.16.1 Optimal result
3.1.16.2 Mathematica [A] (verified)
3.1.16.3 Rubi [A] (verified)
3.1.16.4 Maple [A] (verified)
3.1.16.5 Fricas [A] (verification not implemented)
3.1.16.6 Sympy [B] (verification not implemented)
3.1.16.7 Maxima [F]
3.1.16.8 Giac [A] (verification not implemented)
3.1.16.9 Mupad [B] (verification not implemented)

3.1.16.1 Optimal result

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

output
-1/2*d*(-a*d+b*c)*erf(b*x+a)/b^3-1/3*(-a*d+b*c)^3*erf(b*x+a)/b^3/d+1/3*(d* 
x+c)^3*erf(b*x+a)/d+1/3*d^2/b^3/exp((b*x+a)^2)/Pi^(1/2)+(-a*d+b*c)^2/b^3/e 
xp((b*x+a)^2)/Pi^(1/2)+d*(-a*d+b*c)*(b*x+a)/b^3/exp((b*x+a)^2)/Pi^(1/2)+1/ 
3*d^2*(b*x+a)^2/b^3/exp((b*x+a)^2)/Pi^(1/2)
 
3.1.16.2 Mathematica [A] (verified)

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

input
Integrate[(c + d*x)^2*Erf[a + b*x],x]
 
output
((2*((1 + a^2)*d^2 - a*b*d*(3*c + d*x) + b^2*(3*c^2 + 3*c*d*x + d^2*x^2))) 
/(E^(a + b*x)^2*Sqrt[Pi]) + (-3*b*c*d - 6*a^2*b*c*d + 2*a^3*d^2 + 3*a*(2*b 
^2*c^2 + d^2) + 2*b^3*x*(3*c^2 + 3*c*d*x + d^2*x^2))*Erf[a + b*x])/(6*b^3)
 
3.1.16.3 Rubi [A] (verified)

Time = 0.46 (sec) , antiderivative size = 204, normalized size of antiderivative = 1.06, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.214, Rules used = {6915, 2656, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

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

\(\Big \downarrow \) 6915

\(\displaystyle \frac {(c+d x)^3 \text {erf}(a+b x)}{3 d}-\frac {2 b \int e^{-(a+b x)^2} (c+d x)^3dx}{3 \sqrt {\pi } d}\)

\(\Big \downarrow \) 2656

\(\displaystyle \frac {(c+d x)^3 \text {erf}(a+b x)}{3 d}-\frac {2 b \int \left (\frac {e^{-(a+b x)^2} (b c-a d)^3}{b^3}+\frac {3 d e^{-(a+b x)^2} (a+b x) (b c-a d)^2}{b^3}+\frac {3 d^2 e^{-(a+b x)^2} (a+b x)^2 (b c-a d)}{b^3}+\frac {d^3 e^{-(a+b x)^2} (a+b x)^3}{b^3}\right )dx}{3 \sqrt {\pi } d}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(c+d x)^3 \text {erf}(a+b x)}{3 d}-\frac {2 b \left (\frac {3 \sqrt {\pi } d^2 (b c-a d) \text {erf}(a+b x)}{4 b^4}-\frac {3 d^2 e^{-(a+b x)^2} (a+b x) (b c-a d)}{2 b^4}+\frac {\sqrt {\pi } (b c-a d)^3 \text {erf}(a+b x)}{2 b^4}-\frac {3 d e^{-(a+b x)^2} (b c-a d)^2}{2 b^4}-\frac {d^3 e^{-(a+b x)^2}}{2 b^4}-\frac {d^3 e^{-(a+b x)^2} (a+b x)^2}{2 b^4}\right )}{3 \sqrt {\pi } d}\)

input
Int[(c + d*x)^2*Erf[a + b*x],x]
 
output
((c + d*x)^3*Erf[a + b*x])/(3*d) - (2*b*(-1/2*d^3/(b^4*E^(a + b*x)^2) - (3 
*d*(b*c - a*d)^2)/(2*b^4*E^(a + b*x)^2) - (3*d^2*(b*c - a*d)*(a + b*x))/(2 
*b^4*E^(a + b*x)^2) - (d^3*(a + b*x)^2)/(2*b^4*E^(a + b*x)^2) + (3*d^2*(b* 
c - a*d)*Sqrt[Pi]*Erf[a + b*x])/(4*b^4) + ((b*c - a*d)^3*Sqrt[Pi]*Erf[a + 
b*x])/(2*b^4)))/(3*d*Sqrt[Pi])
 

3.1.16.3.1 Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 2656
Int[(F_)^((a_.) + (b_.)*((c_.) + (d_.)*(x_))^(n_))*(Px_), x_Symbol] :> Int[ 
ExpandLinearProduct[F^(a + b*(c + d*x)^n), Px, c, d, x], x] /; FreeQ[{F, a, 
 b, c, d, n}, x] && PolynomialQ[Px, x]
 

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

Time = 0.97 (sec) , antiderivative size = 272, normalized size of antiderivative = 1.42

method result size
parallelrisch \(\frac {2 d^{2} \operatorname {erf}\left (b x +a \right ) x^{3} \sqrt {\pi }\, b^{3}+6 c d \,\operatorname {erf}\left (b x +a \right ) x^{2} \sqrt {\pi }\, b^{3}+6 c^{2} x \,\operatorname {erf}\left (b x +a \right ) \sqrt {\pi }\, b^{3}+2 \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right ) a^{3} d^{2}-6 \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right ) a^{2} b c d +6 \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right ) a \,b^{2} c^{2}+2 d^{2} x^{2} {\mathrm e}^{-\left (b x +a \right )^{2}} b^{2}-2 x \,{\mathrm e}^{-\left (b x +a \right )^{2}} a b \,d^{2}+6 x \,{\mathrm e}^{-\left (b x +a \right )^{2}} b^{2} c d +3 \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right ) a \,d^{2}-3 \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right ) b c d +2 \,{\mathrm e}^{-\left (b x +a \right )^{2}} a^{2} d^{2}-6 \,{\mathrm e}^{-\left (b x +a \right )^{2}} a b c d +6 \,{\mathrm e}^{-\left (b x +a \right )^{2}} b^{2} c^{2}+2 \,{\mathrm e}^{-\left (b x +a \right )^{2}} d^{2}}{6 \sqrt {\pi }\, b^{3}}\) \(272\)
derivativedivides \(\frac {-\frac {\operatorname {erf}\left (b x +a \right ) \left (a d -b c -d \left (b x +a \right )\right )^{3}}{3 b^{2} d}+\frac {\frac {a^{3} d^{3} \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{3}-\frac {b^{3} c^{3} \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{3}-\frac {2 d^{3} \left (-\frac {{\mathrm e}^{-\left (b x +a \right )^{2}} \left (b x +a \right )^{2}}{2}-\frac {{\mathrm e}^{-\left (b x +a \right )^{2}}}{2}\right )}{3}+2 a \,d^{3} \left (-\frac {\left (b x +a \right ) {\mathrm e}^{-\left (b x +a \right )^{2}}}{2}+\frac {\sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{4}\right )+a^{2} d^{3} {\mathrm e}^{-\left (b x +a \right )^{2}}+a \,b^{2} c^{2} d \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )-a^{2} b c \,d^{2} \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )-2 b c \,d^{2} \left (-\frac {\left (b x +a \right ) {\mathrm e}^{-\left (b x +a \right )^{2}}}{2}+\frac {\sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{4}\right )+b^{2} c^{2} d \,{\mathrm e}^{-\left (b x +a \right )^{2}}-2 a b c \,d^{2} {\mathrm e}^{-\left (b x +a \right )^{2}}}{\sqrt {\pi }\, b^{2} d}}{b}\) \(285\)
default \(\frac {-\frac {\operatorname {erf}\left (b x +a \right ) \left (a d -b c -d \left (b x +a \right )\right )^{3}}{3 b^{2} d}+\frac {\frac {a^{3} d^{3} \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{3}-\frac {b^{3} c^{3} \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{3}-\frac {2 d^{3} \left (-\frac {{\mathrm e}^{-\left (b x +a \right )^{2}} \left (b x +a \right )^{2}}{2}-\frac {{\mathrm e}^{-\left (b x +a \right )^{2}}}{2}\right )}{3}+2 a \,d^{3} \left (-\frac {\left (b x +a \right ) {\mathrm e}^{-\left (b x +a \right )^{2}}}{2}+\frac {\sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{4}\right )+a^{2} d^{3} {\mathrm e}^{-\left (b x +a \right )^{2}}+a \,b^{2} c^{2} d \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )-a^{2} b c \,d^{2} \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )-2 b c \,d^{2} \left (-\frac {\left (b x +a \right ) {\mathrm e}^{-\left (b x +a \right )^{2}}}{2}+\frac {\sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{4}\right )+b^{2} c^{2} d \,{\mathrm e}^{-\left (b x +a \right )^{2}}-2 a b c \,d^{2} {\mathrm e}^{-\left (b x +a \right )^{2}}}{\sqrt {\pi }\, b^{2} d}}{b}\) \(285\)
parts \(\frac {\operatorname {erf}\left (b x +a \right ) d^{2} x^{3}}{3}+\operatorname {erf}\left (b x +a \right ) d c \,x^{2}+\operatorname {erf}\left (b x +a \right ) c^{2} x +\frac {\operatorname {erf}\left (b x +a \right ) c^{3}}{3 d}-\frac {2 b \left (\frac {c^{3} \sqrt {\pi }\, \operatorname {erf}\left (b x +a \right )}{2 b}+{\mathrm e}^{-a^{2}} d^{3} \left (-\frac {x^{2} {\mathrm e}^{-b^{2} x^{2}-2 a b x}}{2 b^{2}}-\frac {a \left (-\frac {x \,{\mathrm e}^{-b^{2} x^{2}-2 a b x}}{2 b^{2}}-\frac {a \left (-\frac {{\mathrm e}^{-b^{2} x^{2}-2 a b x}}{2 b^{2}}-\frac {a \sqrt {\pi }\, {\mathrm e}^{a^{2}} \operatorname {erf}\left (b x +a \right )}{2 b^{2}}\right )}{b}+\frac {\sqrt {\pi }\, {\mathrm e}^{a^{2}} \operatorname {erf}\left (b x +a \right )}{4 b^{3}}\right )}{b}+\frac {-\frac {{\mathrm e}^{-b^{2} x^{2}-2 a b x}}{2 b^{2}}-\frac {a \sqrt {\pi }\, {\mathrm e}^{a^{2}} \operatorname {erf}\left (b x +a \right )}{2 b^{2}}}{b^{2}}\right )+3 \,{\mathrm e}^{-a^{2}} c \,d^{2} \left (-\frac {x \,{\mathrm e}^{-b^{2} x^{2}-2 a b x}}{2 b^{2}}-\frac {a \left (-\frac {{\mathrm e}^{-b^{2} x^{2}-2 a b x}}{2 b^{2}}-\frac {a \sqrt {\pi }\, {\mathrm e}^{a^{2}} \operatorname {erf}\left (b x +a \right )}{2 b^{2}}\right )}{b}+\frac {\sqrt {\pi }\, {\mathrm e}^{a^{2}} \operatorname {erf}\left (b x +a \right )}{4 b^{3}}\right )+3 \,{\mathrm e}^{-a^{2}} d \,c^{2} \left (-\frac {{\mathrm e}^{-b^{2} x^{2}-2 a b x}}{2 b^{2}}-\frac {a \sqrt {\pi }\, {\mathrm e}^{a^{2}} \operatorname {erf}\left (b x +a \right )}{2 b^{2}}\right )\right )}{3 d \sqrt {\pi }}\) \(400\)

input
int((d*x+c)^2*erf(b*x+a),x,method=_RETURNVERBOSE)
 
output
1/6*(2*d^2*erf(b*x+a)*x^3*Pi^(1/2)*b^3+6*c*d*erf(b*x+a)*x^2*Pi^(1/2)*b^3+6 
*c^2*x*erf(b*x+a)*Pi^(1/2)*b^3+2*Pi^(1/2)*erf(b*x+a)*a^3*d^2-6*Pi^(1/2)*er 
f(b*x+a)*a^2*b*c*d+6*Pi^(1/2)*erf(b*x+a)*a*b^2*c^2+2*d^2*x^2*exp(-(b*x+a)^ 
2)*b^2-2*x*exp(-(b*x+a)^2)*a*b*d^2+6*x*exp(-(b*x+a)^2)*b^2*c*d+3*Pi^(1/2)* 
erf(b*x+a)*a*d^2-3*Pi^(1/2)*erf(b*x+a)*b*c*d+2*exp(-(b*x+a)^2)*a^2*d^2-6*e 
xp(-(b*x+a)^2)*a*b*c*d+6*exp(-(b*x+a)^2)*b^2*c^2+2*exp(-(b*x+a)^2)*d^2)/Pi 
^(1/2)/b^3
 
3.1.16.5 Fricas [A] (verification not implemented)

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

input
integrate((d*x+c)^2*erf(b*x+a),x, algorithm="fricas")
 
output
1/6*(2*sqrt(pi)*(b^2*d^2*x^2 + 3*b^2*c^2 - 3*a*b*c*d + (a^2 + 1)*d^2 + (3* 
b^2*c*d - a*b*d^2)*x)*e^(-b^2*x^2 - 2*a*b*x - a^2) + (2*pi*b^3*d^2*x^3 + 6 
*pi*b^3*c*d*x^2 + 6*pi*b^3*c^2*x + pi*(6*a*b^2*c^2 - 3*(2*a^2 + 1)*b*c*d + 
 (2*a^3 + 3*a)*d^2))*erf(b*x + a))/(pi*b^3)
 
3.1.16.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 398 vs. \(2 (165) = 330\).

Time = 0.87 (sec) , antiderivative size = 398, normalized size of antiderivative = 2.07 \[ \int (c+d x)^2 \text {erf}(a+b x) \, dx=\begin {cases} \frac {a^{3} d^{2} \operatorname {erf}{\left (a + b x \right )}}{3 b^{3}} - \frac {a^{2} c d \operatorname {erf}{\left (a + b x \right )}}{b^{2}} + \frac {a^{2} d^{2} e^{- a^{2}} e^{- b^{2} x^{2}} e^{- 2 a b x}}{3 \sqrt {\pi } b^{3}} + \frac {a c^{2} \operatorname {erf}{\left (a + b x \right )}}{b} - \frac {a c d e^{- a^{2}} e^{- b^{2} x^{2}} e^{- 2 a b x}}{\sqrt {\pi } b^{2}} - \frac {a d^{2} x e^{- a^{2}} e^{- b^{2} x^{2}} e^{- 2 a b x}}{3 \sqrt {\pi } b^{2}} + \frac {a d^{2} \operatorname {erf}{\left (a + b x \right )}}{2 b^{3}} + c^{2} x \operatorname {erf}{\left (a + b x \right )} + c d x^{2} \operatorname {erf}{\left (a + b x \right )} + \frac {d^{2} x^{3} \operatorname {erf}{\left (a + b x \right )}}{3} + \frac {c^{2} e^{- a^{2}} e^{- b^{2} x^{2}} e^{- 2 a b x}}{\sqrt {\pi } b} + \frac {c d x e^{- a^{2}} e^{- b^{2} x^{2}} e^{- 2 a b x}}{\sqrt {\pi } b} + \frac {d^{2} x^{2} e^{- a^{2}} e^{- b^{2} x^{2}} e^{- 2 a b x}}{3 \sqrt {\pi } b} - \frac {c d \operatorname {erf}{\left (a + b x \right )}}{2 b^{2}} + \frac {d^{2} e^{- a^{2}} e^{- b^{2} x^{2}} e^{- 2 a b x}}{3 \sqrt {\pi } b^{3}} & \text {for}\: b \neq 0 \\\left (c^{2} x + c d x^{2} + \frac {d^{2} x^{3}}{3}\right ) \operatorname {erf}{\left (a \right )} & \text {otherwise} \end {cases} \]

input
integrate((d*x+c)**2*erf(b*x+a),x)
 
output
Piecewise((a**3*d**2*erf(a + b*x)/(3*b**3) - a**2*c*d*erf(a + b*x)/b**2 + 
a**2*d**2*exp(-a**2)*exp(-b**2*x**2)*exp(-2*a*b*x)/(3*sqrt(pi)*b**3) + a*c 
**2*erf(a + b*x)/b - a*c*d*exp(-a**2)*exp(-b**2*x**2)*exp(-2*a*b*x)/(sqrt( 
pi)*b**2) - a*d**2*x*exp(-a**2)*exp(-b**2*x**2)*exp(-2*a*b*x)/(3*sqrt(pi)* 
b**2) + a*d**2*erf(a + b*x)/(2*b**3) + c**2*x*erf(a + b*x) + c*d*x**2*erf( 
a + b*x) + d**2*x**3*erf(a + b*x)/3 + c**2*exp(-a**2)*exp(-b**2*x**2)*exp( 
-2*a*b*x)/(sqrt(pi)*b) + c*d*x*exp(-a**2)*exp(-b**2*x**2)*exp(-2*a*b*x)/(s 
qrt(pi)*b) + d**2*x**2*exp(-a**2)*exp(-b**2*x**2)*exp(-2*a*b*x)/(3*sqrt(pi 
)*b) - c*d*erf(a + b*x)/(2*b**2) + d**2*exp(-a**2)*exp(-b**2*x**2)*exp(-2* 
a*b*x)/(3*sqrt(pi)*b**3), Ne(b, 0)), ((c**2*x + c*d*x**2 + d**2*x**3/3)*er 
f(a), True))
 
3.1.16.7 Maxima [F]

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

input
integrate((d*x+c)^2*erf(b*x+a),x, algorithm="maxima")
 
output
1/3*(d^2*x^3 + 3*c*d*x^2 + 3*c^2*x)*erf(b*x + a) - 1/3*integrate(2*(b*d^2* 
x^3 + 3*b*c*d*x^2 + 3*b*c^2*x)*e^(-b^2*x^2 - 2*a*b*x - a^2), x)/sqrt(pi)
 
3.1.16.8 Giac [A] (verification not implemented)

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

input
integrate((d*x+c)^2*erf(b*x+a),x, algorithm="giac")
 
output
1/3*(d*x + c)^3*erf(b*x + a)/d + 1/6*(2*sqrt(pi)*c^3*erf(-b*(x + a/b)) - 6 
*(sqrt(pi)*a*erf(-b*(x + a/b))/b - e^(-b^2*x^2 - 2*a*b*x - a^2)/b)*c^2*d + 
 3*(sqrt(pi)*(2*a^2 + 1)*erf(-b*(x + a/b))/b + 2*(b*(x + a/b) - 2*a)*e^(-b 
^2*x^2 - 2*a*b*x - a^2)/b)*c*d^2/b - (sqrt(pi)*(2*a^3 + 3*a)*erf(-b*(x + a 
/b))/b - 2*(b^2*(x + a/b)^2 - 3*a*b*(x + a/b) + 3*a^2 + 1)*e^(-b^2*x^2 - 2 
*a*b*x - a^2)/b)*d^3/b^2)/(sqrt(pi)*d)
 
3.1.16.9 Mupad [B] (verification not implemented)

Time = 5.92 (sec) , antiderivative size = 204, normalized size of antiderivative = 1.06 \[ \int (c+d x)^2 \text {erf}(a+b x) \, dx=\frac {\frac {{\mathrm {e}}^{-a^2-2\,a\,b\,x-b^2\,x^2}\,\left (a^2\,d^2-3\,a\,b\,c\,d+3\,b^2\,c^2+d^2\right )}{b^3}+\frac {d^2\,x^2\,{\mathrm {e}}^{-a^2-2\,a\,b\,x-b^2\,x^2}}{b}-\frac {x\,{\mathrm {e}}^{-a^2-2\,a\,b\,x-b^2\,x^2}\,\left (a\,d^2-3\,b\,c\,d\right )}{b^2}}{3\,\sqrt {\pi }}+\mathrm {erf}\left (a+b\,x\right )\,\left (c^2\,x+c\,d\,x^2+\frac {d^2\,x^3}{3}\right )-\frac {\mathrm {erfi}\left (a\,1{}\mathrm {i}+b\,x\,1{}\mathrm {i}\right )\,\left (2\,a^3\,d^2-6\,a^2\,b\,c\,d+6\,a\,b^2\,c^2+3\,a\,d^2-3\,b\,c\,d\right )\,1{}\mathrm {i}}{6\,b^3} \]

input
int(erf(a + b*x)*(c + d*x)^2,x)
 
output
((exp(- a^2 - b^2*x^2 - 2*a*b*x)*(d^2 + a^2*d^2 + 3*b^2*c^2 - 3*a*b*c*d))/ 
b^3 + (d^2*x^2*exp(- a^2 - b^2*x^2 - 2*a*b*x))/b - (x*exp(- a^2 - b^2*x^2 
- 2*a*b*x)*(a*d^2 - 3*b*c*d))/b^2)/(3*pi^(1/2)) + erf(a + b*x)*(c^2*x + (d 
^2*x^3)/3 + c*d*x^2) - (erfi(a*1i + b*x*1i)*(3*a*d^2 + 2*a^3*d^2 + 6*a*b^2 
*c^2 - 3*b*c*d - 6*a^2*b*c*d)*1i)/(6*b^3)