\(\int (e+f x)^2 (a+b \arctan (c+d x)) \, dx\) [33]

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

Optimal result

Integrand size = 18, antiderivative size = 155 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=-\frac {b f (d e-c f) x}{d^2}-\frac {b f^2 (c+d x)^2}{6 d^3}-\frac {b (d e-c f) \left (d^2 e^2-2 c d e f-\left (3-c^2\right ) f^2\right ) \arctan (c+d x)}{3 d^3 f}+\frac {(e+f x)^3 (a+b \arctan (c+d x))}{3 f}-\frac {b \left (3 d^2 e^2-6 c d e f-\left (1-3 c^2\right ) f^2\right ) \log \left (1+(c+d x)^2\right )}{6 d^3} \] Output:

-b*f*(-c*f+d*e)*x/d^2-1/6*b*f^2*(d*x+c)^2/d^3-1/3*b*(-c*f+d*e)*(d^2*e^2-2* 
c*d*e*f-(-c^2+3)*f^2)*arctan(d*x+c)/d^3/f+1/3*(f*x+e)^3*(a+b*arctan(d*x+c) 
)/f-1/6*b*(3*d^2*e^2-6*c*d*e*f-(-3*c^2+1)*f^2)*ln(1+(d*x+c)^2)/d^3
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.10 (sec) , antiderivative size = 118, normalized size of antiderivative = 0.76 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=\frac {(e+f x)^3 (a+b \arctan (c+d x))-\frac {b \left (6 d f^2 (d e-c f) x+f^3 (c+d x)^2-i (d e-(-i+c) f)^3 \log (i-c-d x)+i (d e-(i+c) f)^3 \log (i+c+d x)\right )}{2 d^3}}{3 f} \] Input:

Integrate[(e + f*x)^2*(a + b*ArcTan[c + d*x]),x]
 

Output:

((e + f*x)^3*(a + b*ArcTan[c + d*x]) - (b*(6*d*f^2*(d*e - c*f)*x + f^3*(c 
+ d*x)^2 - I*(d*e - (-I + c)*f)^3*Log[I - c - d*x] + I*(d*e - (I + c)*f)^3 
*Log[I + c + d*x]))/(2*d^3))/(3*f)
 

Rubi [A] (verified)

Time = 0.43 (sec) , antiderivative size = 163, normalized size of antiderivative = 1.05, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.278, Rules used = {5570, 27, 5387, 478, 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 (e+f x)^2 (a+b \arctan (c+d x)) \, dx\)

\(\Big \downarrow \) 5570

\(\displaystyle \frac {\int \frac {\left (d \left (e-\frac {c f}{d}\right )+f (c+d x)\right )^2 (a+b \arctan (c+d x))}{d^2}d(c+d x)}{d}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {\int (d e-c f+f (c+d x))^2 (a+b \arctan (c+d x))d(c+d x)}{d^3}\)

\(\Big \downarrow \) 5387

\(\displaystyle \frac {\frac {(f (c+d x)-c f+d e)^3 (a+b \arctan (c+d x))}{3 f}-\frac {b \int \frac {(d e-c f+f (c+d x))^3}{(c+d x)^2+1}d(c+d x)}{3 f}}{d^3}\)

\(\Big \downarrow \) 478

\(\displaystyle \frac {\frac {(f (c+d x)-c f+d e)^3 (a+b \arctan (c+d x))}{3 f}-\frac {b \int \left ((c+d x) f^3+3 (d e-c f) f^2+\frac {(d e-c f) \left (d^2 e^2-2 c d f e+c^2 f^2-3 f^2\right )+f \left (3 d^2 e^2-6 c d f e-\left (1-3 c^2\right ) f^2\right ) (c+d x)}{(c+d x)^2+1}\right )d(c+d x)}{3 f}}{d^3}\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {\frac {(f (c+d x)-c f+d e)^3 (a+b \arctan (c+d x))}{3 f}-\frac {b \left (\arctan (c+d x) (d e-c f) \left (-\left (3-c^2\right ) f^2-2 c d e f+d^2 e^2\right )+\frac {1}{2} f \left (-\left (1-3 c^2\right ) f^2-6 c d e f+3 d^2 e^2\right ) \log \left ((c+d x)^2+1\right )+3 f^2 (c+d x) (d e-c f)+\frac {1}{2} f^3 (c+d x)^2\right )}{3 f}}{d^3}\)

Input:

Int[(e + f*x)^2*(a + b*ArcTan[c + d*x]),x]
 

Output:

(((d*e - c*f + f*(c + d*x))^3*(a + b*ArcTan[c + d*x]))/(3*f) - (b*(3*f^2*( 
d*e - c*f)*(c + d*x) + (f^3*(c + d*x)^2)/2 + (d*e - c*f)*(d^2*e^2 - 2*c*d* 
e*f - (3 - c^2)*f^2)*ArcTan[c + d*x] + (f*(3*d^2*e^2 - 6*c*d*e*f - (1 - 3* 
c^2)*f^2)*Log[1 + (c + d*x)^2])/2))/(3*f))/d^3
 

Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 478
Int[((c_) + (d_.)*(x_))^(n_)/((a_) + (b_.)*(x_)^2), x_Symbol] :> Int[Expand 
Integrand[(c + d*x)^n/(a + b*x^2), x], x] /; FreeQ[{a, b, c, d}, x] && IGtQ 
[n, 1]
 

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

rule 5387
Int[((a_.) + ArcTan[(c_.)*(x_)]*(b_.))*((d_) + (e_.)*(x_))^(q_.), x_Symbol] 
 :> Simp[(d + e*x)^(q + 1)*((a + b*ArcTan[c*x])/(e*(q + 1))), x] - Simp[b*( 
c/(e*(q + 1)))   Int[(d + e*x)^(q + 1)/(1 + c^2*x^2), x], x] /; FreeQ[{a, b 
, c, d, e, q}, x] && NeQ[q, -1]
 

rule 5570
Int[((a_.) + ArcTan[(c_) + (d_.)*(x_)]*(b_.))^(p_.)*((e_.) + (f_.)*(x_))^(m 
_.), x_Symbol] :> Simp[1/d   Subst[Int[((d*e - c*f)/d + f*(x/d))^m*(a + b*A 
rcTan[x])^p, x], x, c + d*x], x] /; FreeQ[{a, b, c, d, e, f, m, p}, x] && I 
GtQ[p, 0]
 
Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 265, normalized size of antiderivative = 1.71

method result size
parts \(\frac {a \left (f x +e \right )^{3}}{3 f}+\frac {b c \,e^{2} \arctan \left (d x +c \right )}{d}-\frac {f^{2} b \,x^{2}}{6 d}+\frac {b \,f^{2} \ln \left (1+\left (d x +c \right )^{2}\right )}{6 d^{3}}-\frac {f b \,c^{2} e \arctan \left (d x +c \right )}{d^{2}}+\frac {b f \ln \left (1+\left (d x +c \right )^{2}\right ) c e}{d^{2}}+b f \arctan \left (d x +c \right ) e \,x^{2}+\frac {b \,f^{2} \arctan \left (d x +c \right ) x^{3}}{3}+b \arctan \left (d x +c \right ) x \,e^{2}+\frac {5 b \,f^{2} c^{2}}{6 d^{3}}-\frac {b f c e}{d^{2}}+\frac {f^{2} b \,c^{3} \arctan \left (d x +c \right )}{3 d^{3}}+\frac {2 f^{2} b c x}{3 d^{2}}-\frac {f b e x}{d}-\frac {b \,f^{2} \ln \left (1+\left (d x +c \right )^{2}\right ) c^{2}}{2 d^{3}}-\frac {b \,e^{2} \ln \left (1+\left (d x +c \right )^{2}\right )}{2 d}-\frac {f^{2} b c \arctan \left (d x +c \right )}{d^{3}}+\frac {f b e \arctan \left (d x +c \right )}{d^{2}}\) \(265\)
derivativedivides \(\frac {-\frac {a \left (c f -d e -f \left (d x +c \right )\right )^{3}}{3 d^{2} f}+\frac {b \,f^{2} \arctan \left (d x +c \right ) c^{2} \left (d x +c \right )}{d^{2}}-\frac {2 b f \arctan \left (d x +c \right ) c e \left (d x +c \right )}{d}-\frac {b \,f^{2} \arctan \left (d x +c \right ) c \left (d x +c \right )^{2}}{d^{2}}+b \arctan \left (d x +c \right ) e^{2} \left (d x +c \right )+\frac {b f \arctan \left (d x +c \right ) e \left (d x +c \right )^{2}}{d}+\frac {b \,f^{2} \arctan \left (d x +c \right ) \left (d x +c \right )^{3}}{3 d^{2}}+\frac {b \,f^{2} c \left (d x +c \right )}{d^{2}}-\frac {b f e \left (d x +c \right )}{d}-\frac {b \,f^{2} \left (d x +c \right )^{2}}{6 d^{2}}-\frac {b \,f^{2} \ln \left (1+\left (d x +c \right )^{2}\right ) c^{2}}{2 d^{2}}+\frac {b f \ln \left (1+\left (d x +c \right )^{2}\right ) c e}{d}-\frac {b \ln \left (1+\left (d x +c \right )^{2}\right ) e^{2}}{2}+\frac {b \,f^{2} \ln \left (1+\left (d x +c \right )^{2}\right )}{6 d^{2}}-\frac {b \,f^{2} \arctan \left (d x +c \right ) c}{d^{2}}+\frac {b f \arctan \left (d x +c \right ) e}{d}}{d}\) \(303\)
default \(\frac {-\frac {a \left (c f -d e -f \left (d x +c \right )\right )^{3}}{3 d^{2} f}+\frac {b \,f^{2} \arctan \left (d x +c \right ) c^{2} \left (d x +c \right )}{d^{2}}-\frac {2 b f \arctan \left (d x +c \right ) c e \left (d x +c \right )}{d}-\frac {b \,f^{2} \arctan \left (d x +c \right ) c \left (d x +c \right )^{2}}{d^{2}}+b \arctan \left (d x +c \right ) e^{2} \left (d x +c \right )+\frac {b f \arctan \left (d x +c \right ) e \left (d x +c \right )^{2}}{d}+\frac {b \,f^{2} \arctan \left (d x +c \right ) \left (d x +c \right )^{3}}{3 d^{2}}+\frac {b \,f^{2} c \left (d x +c \right )}{d^{2}}-\frac {b f e \left (d x +c \right )}{d}-\frac {b \,f^{2} \left (d x +c \right )^{2}}{6 d^{2}}-\frac {b \,f^{2} \ln \left (1+\left (d x +c \right )^{2}\right ) c^{2}}{2 d^{2}}+\frac {b f \ln \left (1+\left (d x +c \right )^{2}\right ) c e}{d}-\frac {b \ln \left (1+\left (d x +c \right )^{2}\right ) e^{2}}{2}+\frac {b \,f^{2} \ln \left (1+\left (d x +c \right )^{2}\right )}{6 d^{2}}-\frac {b \,f^{2} \arctan \left (d x +c \right ) c}{d^{2}}+\frac {b f \arctan \left (d x +c \right ) e}{d}}{d}\) \(303\)
parallelrisch \(-\frac {-\ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b \,f^{2}-f^{2} b +6 a \,c^{2} e f d +6 e f a d +7 b \,c^{2} f^{2}-12 b c d e f +6 \arctan \left (d x +c \right ) b \,c^{2} d e f -6 \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b c d e f -6 x^{2} \arctan \left (d x +c \right ) b \,d^{3} e f -6 x^{2} a \,d^{3} e f -6 \arctan \left (d x +c \right ) b c \,d^{2} e^{2}-6 \arctan \left (d x +c \right ) b d e f -2 x^{3} \arctan \left (d x +c \right ) b \,d^{3} f^{2}-6 x \arctan \left (d x +c \right ) b \,d^{3} e^{2}-4 x b c d \,f^{2}+6 x b \,d^{2} e f +12 a c \,e^{2} d^{2}+x^{2} b \,d^{2} f^{2}+3 \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b \,c^{2} f^{2}+3 \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b \,d^{2} e^{2}-2 \arctan \left (d x +c \right ) b \,c^{3} f^{2}+6 \arctan \left (d x +c \right ) b c \,f^{2}-6 x a \,d^{3} e^{2}-2 x^{3} a \,d^{3} f^{2}}{6 d^{3}}\) \(341\)
risch \(-\frac {i \left (f x +e \right )^{3} b \ln \left (1+i \left (d x +c \right )\right )}{6 f}+\frac {f b c e \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right )}{d^{2}}-\frac {e^{2} b \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right )}{2 d}+\frac {f^{2} b \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right )}{6 d^{3}}+\frac {f^{2} b \,c^{3} \arctan \left (d x +c \right )}{3 d^{3}}-\frac {f^{2} b c \arctan \left (d x +c \right )}{d^{3}}-\frac {f^{2} b \,c^{2} \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right )}{2 d^{3}}-\frac {b \,e^{3} \arctan \left (d x +c \right )}{6 f}+\frac {x^{3} f^{2} a}{3}-\frac {f^{2} b \,x^{2}}{6 d}+\frac {f b e \arctan \left (d x +c \right )}{d^{2}}+\frac {i f b e \,x^{2} \ln \left (1-i \left (d x +c \right )\right )}{2}+\frac {i b \,e^{3} \ln \left (d^{2} x^{2}+2 c d x +c^{2}+1\right )}{12 f}+\frac {i b \,e^{2} x \ln \left (1-i \left (d x +c \right )\right )}{2}-\frac {f b \,c^{2} e \arctan \left (d x +c \right )}{d^{2}}+\frac {b c \,e^{2} \arctan \left (d x +c \right )}{d}+\frac {i f^{2} b \,x^{3} \ln \left (1-i \left (d x +c \right )\right )}{6}+x^{2} f e a +x a \,e^{2}+\frac {2 f^{2} b c x}{3 d^{2}}-\frac {f b e x}{d}\) \(373\)

Input:

int((f*x+e)^2*(a+b*arctan(d*x+c)),x,method=_RETURNVERBOSE)
 

Output:

1/3*a*(f*x+e)^3/f+1/d*b*c*e^2*arctan(d*x+c)-1/6*f^2/d*b*x^2+1/6*b/d^3*f^2* 
ln(1+(d*x+c)^2)-f/d^2*b*c^2*e*arctan(d*x+c)+b/d^2*f*ln(1+(d*x+c)^2)*c*e+b* 
f*arctan(d*x+c)*e*x^2+1/3*b*f^2*arctan(d*x+c)*x^3+b*arctan(d*x+c)*x*e^2+5/ 
6*b/d^3*f^2*c^2-b/d^2*f*c*e+1/3*f^2/d^3*b*c^3*arctan(d*x+c)+2/3*f^2/d^2*b* 
c*x-f/d*b*e*x-1/2*b/d^3*f^2*ln(1+(d*x+c)^2)*c^2-1/2*b*e^2*ln(1+(d*x+c)^2)/ 
d-f^2/d^3*b*c*arctan(d*x+c)+f/d^2*b*e*arctan(d*x+c)
 

Fricas [A] (verification not implemented)

Time = 0.12 (sec) , antiderivative size = 199, normalized size of antiderivative = 1.28 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=\frac {2 \, a d^{3} f^{2} x^{3} + {\left (6 \, a d^{3} e f - b d^{2} f^{2}\right )} x^{2} + 2 \, {\left (3 \, a d^{3} e^{2} - 3 \, b d^{2} e f + 2 \, b c d f^{2}\right )} x + 2 \, {\left (b d^{3} f^{2} x^{3} + 3 \, b d^{3} e f x^{2} + 3 \, b d^{3} e^{2} x + 3 \, b c d^{2} e^{2} - 3 \, {\left (b c^{2} - b\right )} d e f + {\left (b c^{3} - 3 \, b c\right )} f^{2}\right )} \arctan \left (d x + c\right ) - {\left (3 \, b d^{2} e^{2} - 6 \, b c d e f + {\left (3 \, b c^{2} - b\right )} f^{2}\right )} \log \left (d^{2} x^{2} + 2 \, c d x + c^{2} + 1\right )}{6 \, d^{3}} \] Input:

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

Output:

1/6*(2*a*d^3*f^2*x^3 + (6*a*d^3*e*f - b*d^2*f^2)*x^2 + 2*(3*a*d^3*e^2 - 3* 
b*d^2*e*f + 2*b*c*d*f^2)*x + 2*(b*d^3*f^2*x^3 + 3*b*d^3*e*f*x^2 + 3*b*d^3* 
e^2*x + 3*b*c*d^2*e^2 - 3*(b*c^2 - b)*d*e*f + (b*c^3 - 3*b*c)*f^2)*arctan( 
d*x + c) - (3*b*d^2*e^2 - 6*b*c*d*e*f + (3*b*c^2 - b)*f^2)*log(d^2*x^2 + 2 
*c*d*x + c^2 + 1))/d^3
 

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 4.72 (sec) , antiderivative size = 376, normalized size of antiderivative = 2.43 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=\begin {cases} a e^{2} x + a e f x^{2} + \frac {a f^{2} x^{3}}{3} + \frac {b c^{3} f^{2} \operatorname {atan}{\left (c + d x \right )}}{3 d^{3}} - \frac {b c^{2} e f \operatorname {atan}{\left (c + d x \right )}}{d^{2}} - \frac {b c^{2} f^{2} \log {\left (\frac {c}{d} + x - \frac {i}{d} \right )}}{d^{3}} + \frac {i b c^{2} f^{2} \operatorname {atan}{\left (c + d x \right )}}{d^{3}} + \frac {b c e^{2} \operatorname {atan}{\left (c + d x \right )}}{d} + \frac {2 b c e f \log {\left (\frac {c}{d} + x - \frac {i}{d} \right )}}{d^{2}} - \frac {2 i b c e f \operatorname {atan}{\left (c + d x \right )}}{d^{2}} + \frac {2 b c f^{2} x}{3 d^{2}} - \frac {b c f^{2} \operatorname {atan}{\left (c + d x \right )}}{d^{3}} + b e^{2} x \operatorname {atan}{\left (c + d x \right )} + b e f x^{2} \operatorname {atan}{\left (c + d x \right )} + \frac {b f^{2} x^{3} \operatorname {atan}{\left (c + d x \right )}}{3} - \frac {b e^{2} \log {\left (\frac {c}{d} + x - \frac {i}{d} \right )}}{d} + \frac {i b e^{2} \operatorname {atan}{\left (c + d x \right )}}{d} - \frac {b e f x}{d} - \frac {b f^{2} x^{2}}{6 d} + \frac {b e f \operatorname {atan}{\left (c + d x \right )}}{d^{2}} + \frac {b f^{2} \log {\left (\frac {c}{d} + x - \frac {i}{d} \right )}}{3 d^{3}} - \frac {i b f^{2} \operatorname {atan}{\left (c + d x \right )}}{3 d^{3}} & \text {for}\: d \neq 0 \\\left (a + b \operatorname {atan}{\left (c \right )}\right ) \left (e^{2} x + e f x^{2} + \frac {f^{2} x^{3}}{3}\right ) & \text {otherwise} \end {cases} \] Input:

integrate((f*x+e)**2*(a+b*atan(d*x+c)),x)
 

Output:

Piecewise((a*e**2*x + a*e*f*x**2 + a*f**2*x**3/3 + b*c**3*f**2*atan(c + d* 
x)/(3*d**3) - b*c**2*e*f*atan(c + d*x)/d**2 - b*c**2*f**2*log(c/d + x - I/ 
d)/d**3 + I*b*c**2*f**2*atan(c + d*x)/d**3 + b*c*e**2*atan(c + d*x)/d + 2* 
b*c*e*f*log(c/d + x - I/d)/d**2 - 2*I*b*c*e*f*atan(c + d*x)/d**2 + 2*b*c*f 
**2*x/(3*d**2) - b*c*f**2*atan(c + d*x)/d**3 + b*e**2*x*atan(c + d*x) + b* 
e*f*x**2*atan(c + d*x) + b*f**2*x**3*atan(c + d*x)/3 - b*e**2*log(c/d + x 
- I/d)/d + I*b*e**2*atan(c + d*x)/d - b*e*f*x/d - b*f**2*x**2/(6*d) + b*e* 
f*atan(c + d*x)/d**2 + b*f**2*log(c/d + x - I/d)/(3*d**3) - I*b*f**2*atan( 
c + d*x)/(3*d**3), Ne(d, 0)), ((a + b*atan(c))*(e**2*x + e*f*x**2 + f**2*x 
**3/3), True))
 

Maxima [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 220, normalized size of antiderivative = 1.42 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=\frac {1}{3} \, a f^{2} x^{3} + a e f x^{2} + {\left (x^{2} \arctan \left (d x + c\right ) - d {\left (\frac {x}{d^{2}} + \frac {{\left (c^{2} - 1\right )} \arctan \left (\frac {d^{2} x + c d}{d}\right )}{d^{3}} - \frac {c \log \left (d^{2} x^{2} + 2 \, c d x + c^{2} + 1\right )}{d^{3}}\right )}\right )} b e f + \frac {1}{6} \, {\left (2 \, x^{3} \arctan \left (d x + c\right ) - d {\left (\frac {d x^{2} - 4 \, c x}{d^{3}} - \frac {2 \, {\left (c^{3} - 3 \, c\right )} \arctan \left (\frac {d^{2} x + c d}{d}\right )}{d^{4}} + \frac {{\left (3 \, c^{2} - 1\right )} \log \left (d^{2} x^{2} + 2 \, c d x + c^{2} + 1\right )}{d^{4}}\right )}\right )} b f^{2} + a e^{2} x + \frac {{\left (2 \, {\left (d x + c\right )} \arctan \left (d x + c\right ) - \log \left ({\left (d x + c\right )}^{2} + 1\right )\right )} b e^{2}}{2 \, d} \] Input:

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

Output:

1/3*a*f^2*x^3 + a*e*f*x^2 + (x^2*arctan(d*x + c) - d*(x/d^2 + (c^2 - 1)*ar 
ctan((d^2*x + c*d)/d)/d^3 - c*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/d^3))*b*e*f 
 + 1/6*(2*x^3*arctan(d*x + c) - d*((d*x^2 - 4*c*x)/d^3 - 2*(c^3 - 3*c)*arc 
tan((d^2*x + c*d)/d)/d^4 + (3*c^2 - 1)*log(d^2*x^2 + 2*c*d*x + c^2 + 1)/d^ 
4))*b*f^2 + a*e^2*x + 1/2*(2*(d*x + c)*arctan(d*x + c) - log((d*x + c)^2 + 
 1))*b*e^2/d
                                                                                    
                                                                                    
 

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 512 vs. \(2 (143) = 286\).

Time = 0.45 (sec) , antiderivative size = 512, normalized size of antiderivative = 3.30 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=\frac {2 \, b d^{3} f^{2} x^{3} \arctan \left (d x + c\right ) + 2 \, a d^{3} f^{2} x^{3} + 6 \, b d^{3} e f x^{2} \arctan \left (d x + c\right ) + 6 \, a d^{3} e f x^{2} + 6 \, b d^{3} e^{2} x \arctan \left (d x + c\right ) - 3 \, \pi b c d^{2} e^{2} \mathrm {sgn}\left (d x + c\right ) + 3 \, \pi b c^{2} d e f \mathrm {sgn}\left (d x + c\right ) - \pi b c^{3} f^{2} \mathrm {sgn}\left (d x + c\right ) + 3 \, \pi b c d^{2} e^{2} \mathrm {sgn}\left (-d x - c\right ) - 3 \, \pi b c^{2} d e f \mathrm {sgn}\left (-d x - c\right ) + \pi b c^{3} f^{2} \mathrm {sgn}\left (-d x - c\right ) + 6 \, a d^{3} e^{2} x - b d^{2} f^{2} x^{2} + 3 \, b c d^{2} e^{2} \arctan \left (d x + c\right ) - 3 \, b c^{2} d e f \arctan \left (d x + c\right ) + b c^{3} f^{2} \arctan \left (d x + c\right ) - 3 \, b c d^{2} e^{2} \arctan \left (-d x - c\right ) + 3 \, b c^{2} d e f \arctan \left (-d x - c\right ) - b c^{3} f^{2} \arctan \left (-d x - c\right ) - 6 \, b d^{2} e f x + 4 \, b c d f^{2} x - 3 \, b d^{2} e^{2} \log \left ({\left (d x + c\right )}^{2} + 1\right ) + 6 \, b c d e f \log \left ({\left (d x + c\right )}^{2} + 1\right ) - 3 \, b c^{2} f^{2} \log \left ({\left (d x + c\right )}^{2} + 1\right ) - 3 \, \pi b d e f \mathrm {sgn}\left (d x + c\right ) + 3 \, \pi b c f^{2} \mathrm {sgn}\left (d x + c\right ) + 3 \, \pi b d e f \mathrm {sgn}\left (-d x - c\right ) - 3 \, \pi b c f^{2} \mathrm {sgn}\left (-d x - c\right ) + 3 \, b d e f \arctan \left (d x + c\right ) - 3 \, b c f^{2} \arctan \left (d x + c\right ) - 3 \, b d e f \arctan \left (-d x - c\right ) + 3 \, b c f^{2} \arctan \left (-d x - c\right ) + b f^{2} \log \left ({\left (d x + c\right )}^{2} + 1\right )}{6 \, d^{3}} \] Input:

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

Output:

1/6*(2*b*d^3*f^2*x^3*arctan(d*x + c) + 2*a*d^3*f^2*x^3 + 6*b*d^3*e*f*x^2*a 
rctan(d*x + c) + 6*a*d^3*e*f*x^2 + 6*b*d^3*e^2*x*arctan(d*x + c) - 3*pi*b* 
c*d^2*e^2*sgn(d*x + c) + 3*pi*b*c^2*d*e*f*sgn(d*x + c) - pi*b*c^3*f^2*sgn( 
d*x + c) + 3*pi*b*c*d^2*e^2*sgn(-d*x - c) - 3*pi*b*c^2*d*e*f*sgn(-d*x - c) 
 + pi*b*c^3*f^2*sgn(-d*x - c) + 6*a*d^3*e^2*x - b*d^2*f^2*x^2 + 3*b*c*d^2* 
e^2*arctan(d*x + c) - 3*b*c^2*d*e*f*arctan(d*x + c) + b*c^3*f^2*arctan(d*x 
 + c) - 3*b*c*d^2*e^2*arctan(-d*x - c) + 3*b*c^2*d*e*f*arctan(-d*x - c) - 
b*c^3*f^2*arctan(-d*x - c) - 6*b*d^2*e*f*x + 4*b*c*d*f^2*x - 3*b*d^2*e^2*l 
og((d*x + c)^2 + 1) + 6*b*c*d*e*f*log((d*x + c)^2 + 1) - 3*b*c^2*f^2*log(( 
d*x + c)^2 + 1) - 3*pi*b*d*e*f*sgn(d*x + c) + 3*pi*b*c*f^2*sgn(d*x + c) + 
3*pi*b*d*e*f*sgn(-d*x - c) - 3*pi*b*c*f^2*sgn(-d*x - c) + 3*b*d*e*f*arctan 
(d*x + c) - 3*b*c*f^2*arctan(d*x + c) - 3*b*d*e*f*arctan(-d*x - c) + 3*b*c 
*f^2*arctan(-d*x - c) + b*f^2*log((d*x + c)^2 + 1))/d^3
 

Mupad [B] (verification not implemented)

Time = 1.18 (sec) , antiderivative size = 411, normalized size of antiderivative = 2.65 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=x^2\,\left (\frac {f\,\left (6\,a\,c\,f-b\,f+6\,a\,d\,e\right )}{6\,d}-\frac {a\,c\,f^2}{d}\right )-x\,\left (\frac {2\,c\,\left (\frac {f\,\left (6\,a\,c\,f-b\,f+6\,a\,d\,e\right )}{3\,d}-\frac {2\,a\,c\,f^2}{d}\right )}{d}-\frac {3\,a\,c^2\,f^2+12\,a\,c\,d\,e\,f+3\,a\,d^2\,e^2-3\,b\,d\,e\,f+3\,a\,f^2}{3\,d^2}+\frac {a\,f^2\,\left (3\,c^2+3\right )}{3\,d^2}\right )+\mathrm {atan}\left (c+d\,x\right )\,\left (b\,e^2\,x+b\,e\,f\,x^2+\frac {b\,f^2\,x^3}{3}\right )+\frac {a\,f^2\,x^3}{3}-\frac {\ln \left (c^2+2\,c\,d\,x+d^2\,x^2+1\right )\,\left (36\,b\,c^2\,d^3\,f^2-72\,b\,c\,d^4\,e\,f+36\,b\,d^5\,e^2-12\,b\,d^3\,f^2\right )}{72\,d^6}+\frac {b\,\mathrm {atan}\left (\frac {3\,d^2\,\left (\frac {c\,\left (c^3\,f^2-3\,c^2\,d\,e\,f+3\,c\,d^2\,e^2-3\,c\,f^2+3\,d\,e\,f\right )}{3\,d^2}+\frac {x\,\left (c^3\,f^2-3\,c^2\,d\,e\,f+3\,c\,d^2\,e^2-3\,c\,f^2+3\,d\,e\,f\right )}{3\,d}\right )}{c^3\,f^2-3\,c^2\,d\,e\,f+3\,c\,d^2\,e^2-3\,c\,f^2+3\,d\,e\,f}\right )\,\left (c^3\,f^2-3\,c^2\,d\,e\,f+3\,c\,d^2\,e^2-3\,c\,f^2+3\,d\,e\,f\right )}{3\,d^3} \] Input:

int((e + f*x)^2*(a + b*atan(c + d*x)),x)
 

Output:

x^2*((f*(6*a*c*f - b*f + 6*a*d*e))/(6*d) - (a*c*f^2)/d) - x*((2*c*((f*(6*a 
*c*f - b*f + 6*a*d*e))/(3*d) - (2*a*c*f^2)/d))/d - (3*a*f^2 + 3*a*c^2*f^2 
+ 3*a*d^2*e^2 - 3*b*d*e*f + 12*a*c*d*e*f)/(3*d^2) + (a*f^2*(3*c^2 + 3))/(3 
*d^2)) + atan(c + d*x)*((b*f^2*x^3)/3 + b*e^2*x + b*e*f*x^2) + (a*f^2*x^3) 
/3 - (log(c^2 + d^2*x^2 + 2*c*d*x + 1)*(36*b*d^5*e^2 - 12*b*d^3*f^2 + 36*b 
*c^2*d^3*f^2 - 72*b*c*d^4*e*f))/(72*d^6) + (b*atan((3*d^2*((c*(c^3*f^2 - 3 
*c*f^2 + 3*c*d^2*e^2 + 3*d*e*f - 3*c^2*d*e*f))/(3*d^2) + (x*(c^3*f^2 - 3*c 
*f^2 + 3*c*d^2*e^2 + 3*d*e*f - 3*c^2*d*e*f))/(3*d)))/(c^3*f^2 - 3*c*f^2 + 
3*c*d^2*e^2 + 3*d*e*f - 3*c^2*d*e*f))*(c^3*f^2 - 3*c*f^2 + 3*c*d^2*e^2 + 3 
*d*e*f - 3*c^2*d*e*f))/(3*d^3)
 

Reduce [B] (verification not implemented)

Time = 0.20 (sec) , antiderivative size = 293, normalized size of antiderivative = 1.89 \[ \int (e+f x)^2 (a+b \arctan (c+d x)) \, dx=\frac {2 \mathit {atan} \left (d x +c \right ) b \,c^{3} f^{2}-6 \mathit {atan} \left (d x +c \right ) b \,c^{2} d e f +6 \mathit {atan} \left (d x +c \right ) b c \,d^{2} e^{2}-6 \mathit {atan} \left (d x +c \right ) b c \,f^{2}+6 \mathit {atan} \left (d x +c \right ) b \,d^{3} e^{2} x +6 \mathit {atan} \left (d x +c \right ) b \,d^{3} e f \,x^{2}+2 \mathit {atan} \left (d x +c \right ) b \,d^{3} f^{2} x^{3}+6 \mathit {atan} \left (d x +c \right ) b d e f -3 \,\mathrm {log}\left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b \,c^{2} f^{2}+6 \,\mathrm {log}\left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b c d e f -3 \,\mathrm {log}\left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b \,d^{2} e^{2}+\mathrm {log}\left (d^{2} x^{2}+2 c d x +c^{2}+1\right ) b \,f^{2}+6 a \,d^{3} e^{2} x +6 a \,d^{3} e f \,x^{2}+2 a \,d^{3} f^{2} x^{3}+4 b c d \,f^{2} x -6 b \,d^{2} e f x -b \,d^{2} f^{2} x^{2}}{6 d^{3}} \] Input:

int((f*x+e)^2*(a+b*atan(d*x+c)),x)
 

Output:

(2*atan(c + d*x)*b*c**3*f**2 - 6*atan(c + d*x)*b*c**2*d*e*f + 6*atan(c + d 
*x)*b*c*d**2*e**2 - 6*atan(c + d*x)*b*c*f**2 + 6*atan(c + d*x)*b*d**3*e**2 
*x + 6*atan(c + d*x)*b*d**3*e*f*x**2 + 2*atan(c + d*x)*b*d**3*f**2*x**3 + 
6*atan(c + d*x)*b*d*e*f - 3*log(c**2 + 2*c*d*x + d**2*x**2 + 1)*b*c**2*f** 
2 + 6*log(c**2 + 2*c*d*x + d**2*x**2 + 1)*b*c*d*e*f - 3*log(c**2 + 2*c*d*x 
 + d**2*x**2 + 1)*b*d**2*e**2 + log(c**2 + 2*c*d*x + d**2*x**2 + 1)*b*f**2 
 + 6*a*d**3*e**2*x + 6*a*d**3*e*f*x**2 + 2*a*d**3*f**2*x**3 + 4*b*c*d*f**2 
*x - 6*b*d**2*e*f*x - b*d**2*f**2*x**2)/(6*d**3)