3.6.10 \(\int (a+b \tan (d+e x)) (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x))^2 \, dx\) [510]

3.6.10.1 Optimal result
3.6.10.2 Mathematica [C] (verified)
3.6.10.3 Rubi [A] (verified)
3.6.10.4 Maple [A] (verified)
3.6.10.5 Fricas [A] (verification not implemented)
3.6.10.6 Sympy [A] (verification not implemented)
3.6.10.7 Maxima [A] (verification not implemented)
3.6.10.8 Giac [B] (verification not implemented)
3.6.10.9 Mupad [B] (verification not implemented)

3.6.10.1 Optimal result

Integrand size = 39, antiderivative size = 144 \[ \int (a+b \tan (d+e x)) \left (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x)\right )^2 \, dx=a \left (a^2-3 b^2\right ) \left (a^2+b^2\right ) x+\frac {b \left (3 a^2-b^2\right ) \left (a^2+b^2\right ) \log (\cos (d+e x))}{e}-\frac {a \left (a^4-b^4\right ) \tan (d+e x)}{e}+\frac {b \left (a^2+b^2\right ) (b+a \tan (d+e x))^2}{2 e}+\frac {\left (a^2+b^2\right ) (b+a \tan (d+e x))^3}{3 e}+\frac {b (b+a \tan (d+e x))^4}{4 e} \]

output
a*(a^2-3*b^2)*(a^2+b^2)*x+b*(3*a^2-b^2)*(a^2+b^2)*ln(cos(e*x+d))/e-a*(a^4- 
b^4)*tan(e*x+d)/e+1/2*b*(a^2+b^2)*(b+a*tan(e*x+d))^2/e+1/3*(a^2+b^2)*(b+a* 
tan(e*x+d))^3/e+1/4*b*(b+a*tan(e*x+d))^4/e
 
3.6.10.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.72 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.06 \[ \int (a+b \tan (d+e x)) \left (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x)\right )^2 \, dx=\frac {6 \left (a^2+b^2\right ) \left (-i (a-i b)^3 \log (i-\tan (d+e x))+i (a+i b)^3 \log (i+\tan (d+e x))\right )-12 a \left (a^4-2 a^2 b^2-4 b^4\right ) \tan (d+e x)+18 a^2 b \left (a^2+2 b^2\right ) \tan ^2(d+e x)+4 a^3 \left (a^2+4 b^2\right ) \tan ^3(d+e x)+3 a^4 b \tan ^4(d+e x)}{12 e} \]

input
Integrate[(a + b*Tan[d + e*x])*(b^2 + 2*a*b*Tan[d + e*x] + a^2*Tan[d + e*x 
]^2)^2,x]
 
output
(6*(a^2 + b^2)*((-I)*(a - I*b)^3*Log[I - Tan[d + e*x]] + I*(a + I*b)^3*Log 
[I + Tan[d + e*x]]) - 12*a*(a^4 - 2*a^2*b^2 - 4*b^4)*Tan[d + e*x] + 18*a^2 
*b*(a^2 + 2*b^2)*Tan[d + e*x]^2 + 4*a^3*(a^2 + 4*b^2)*Tan[d + e*x]^3 + 3*a 
^4*b*Tan[d + e*x]^4)/(12*e)
 
3.6.10.3 Rubi [A] (verified)

Time = 0.85 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.04, number of steps used = 14, number of rules used = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.359, Rules used = {3042, 4191, 27, 3042, 4011, 27, 3042, 4011, 3042, 4011, 3042, 4008, 3042, 3956}

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 (a+b \tan (d+e x)) \left (a^2 \tan ^2(d+e x)+2 a b \tan (d+e x)+b^2\right )^2 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (d+e x)) \left (a^2 \tan (d+e x)^2+2 a b \tan (d+e x)+b^2\right )^2dx\)

\(\Big \downarrow \) 4191

\(\displaystyle \frac {\int 16 \left (\tan (d+e x) a^2+b a\right )^4 (a+b \tan (d+e x))dx}{16 a^4}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {\int \left (\tan (d+e x) a^2+b a\right )^4 (a+b \tan (d+e x))dx}{a^4}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {\int \left (\tan (d+e x) a^2+b a\right )^4 (a+b \tan (d+e x))dx}{a^4}\)

\(\Big \downarrow \) 4011

\(\displaystyle \frac {\int a \left (a^2+b^2\right ) \tan (d+e x) \left (\tan (d+e x) a^2+b a\right )^3dx+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 27

\(\displaystyle \frac {a \left (a^2+b^2\right ) \int \tan (d+e x) \left (\tan (d+e x) a^2+b a\right )^3dx+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a \left (a^2+b^2\right ) \int \tan (d+e x) \left (\tan (d+e x) a^2+b a\right )^3dx+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 4011

\(\displaystyle \frac {a \left (a^2+b^2\right ) \left (\int \left (\tan (d+e x) a^2+b a\right )^2 \left (a b \tan (d+e x)-a^2\right )dx+\frac {\left (a^2 \tan (d+e x)+a b\right )^3}{3 e}\right )+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a \left (a^2+b^2\right ) \left (\int \left (\tan (d+e x) a^2+b a\right )^2 \left (a b \tan (d+e x)-a^2\right )dx+\frac {\left (a^2 \tan (d+e x)+a b\right )^3}{3 e}\right )+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 4011

\(\displaystyle \frac {a \left (a^2+b^2\right ) \left (\int \left (\tan (d+e x) a^2+b a\right ) \left (-2 b a^3-\left (a^2-b^2\right ) \tan (d+e x) a^2\right )dx+\frac {\left (a^2 \tan (d+e x)+a b\right )^3}{3 e}+\frac {a b \left (a^2 \tan (d+e x)+a b\right )^2}{2 e}\right )+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a \left (a^2+b^2\right ) \left (\int \left (\tan (d+e x) a^2+b a\right ) \left (-2 b a^3-\left (a^2-b^2\right ) \tan (d+e x) a^2\right )dx+\frac {\left (a^2 \tan (d+e x)+a b\right )^3}{3 e}+\frac {a b \left (a^2 \tan (d+e x)+a b\right )^2}{2 e}\right )+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 4008

\(\displaystyle \frac {a \left (a^2+b^2\right ) \left (-a^3 b \left (3 a^2-b^2\right ) \int \tan (d+e x)dx+\frac {a b \left (a^2 \tan (d+e x)+a b\right )^2}{2 e}+\frac {\left (a^2 \tan (d+e x)+a b\right )^3}{3 e}-\frac {a^4 \left (a^2-b^2\right ) \tan (d+e x)}{e}+a^4 x \left (a^2-3 b^2\right )\right )+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {a \left (a^2+b^2\right ) \left (-a^3 b \left (3 a^2-b^2\right ) \int \tan (d+e x)dx+\frac {a b \left (a^2 \tan (d+e x)+a b\right )^2}{2 e}+\frac {\left (a^2 \tan (d+e x)+a b\right )^3}{3 e}-\frac {a^4 \left (a^2-b^2\right ) \tan (d+e x)}{e}+a^4 x \left (a^2-3 b^2\right )\right )+\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}}{a^4}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {\frac {b \left (a^2 \tan (d+e x)+a b\right )^4}{4 e}+a \left (a^2+b^2\right ) \left (\frac {a b \left (a^2 \tan (d+e x)+a b\right )^2}{2 e}+\frac {\left (a^2 \tan (d+e x)+a b\right )^3}{3 e}-\frac {a^4 \left (a^2-b^2\right ) \tan (d+e x)}{e}+a^4 x \left (a^2-3 b^2\right )+\frac {a^3 b \left (3 a^2-b^2\right ) \log (\cos (d+e x))}{e}\right )}{a^4}\)

input
Int[(a + b*Tan[d + e*x])*(b^2 + 2*a*b*Tan[d + e*x] + a^2*Tan[d + e*x]^2)^2 
,x]
 
output
((b*(a*b + a^2*Tan[d + e*x])^4)/(4*e) + a*(a^2 + b^2)*(a^4*(a^2 - 3*b^2)*x 
 + (a^3*b*(3*a^2 - b^2)*Log[Cos[d + e*x]])/e - (a^4*(a^2 - b^2)*Tan[d + e* 
x])/e + (a*b*(a*b + a^2*Tan[d + e*x])^2)/(2*e) + (a*b + a^2*Tan[d + e*x])^ 
3/(3*e)))/a^4
 

3.6.10.3.1 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 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[m, 0]
 

rule 4191
Int[((A_) + (B_.)*tan[(d_.) + (e_.)*(x_)])*((a_) + (b_.)*tan[(d_.) + (e_.)* 
(x_)] + (c_.)*tan[(d_.) + (e_.)*(x_)]^2)^(n_), x_Symbol] :> Simp[1/(4^n*c^n 
)   Int[(A + B*Tan[d + e*x])*(b + 2*c*Tan[d + e*x])^(2*n), x], x] /; FreeQ[ 
{a, b, c, d, e, A, B}, x] && EqQ[b^2 - 4*a*c, 0] && IntegerQ[n]
 
3.6.10.4 Maple [A] (verified)

Time = 0.26 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.08

method result size
norman \(\left (a^{5}-2 a^{3} b^{2}-3 a \,b^{4}\right ) x -\frac {a \left (a^{4}-2 a^{2} b^{2}-4 b^{4}\right ) \tan \left (e x +d \right )}{e}+\frac {a^{3} \left (a^{2}+4 b^{2}\right ) \tan \left (e x +d \right )^{3}}{3 e}+\frac {a^{4} b \tan \left (e x +d \right )^{4}}{4 e}+\frac {3 a^{2} b \left (a^{2}+2 b^{2}\right ) \tan \left (e x +d \right )^{2}}{2 e}-\frac {b \left (3 a^{4}+2 a^{2} b^{2}-b^{4}\right ) \ln \left (1+\tan \left (e x +d \right )^{2}\right )}{2 e}\) \(155\)
derivativedivides \(\frac {\frac {a^{4} b \tan \left (e x +d \right )^{4}}{4}+\frac {a^{5} \tan \left (e x +d \right )^{3}}{3}+\frac {4 a^{3} b^{2} \tan \left (e x +d \right )^{3}}{3}+\frac {3 a^{4} b \tan \left (e x +d \right )^{2}}{2}+3 a^{2} b^{3} \tan \left (e x +d \right )^{2}-\tan \left (e x +d \right ) a^{5}+2 \tan \left (e x +d \right ) a^{3} b^{2}+4 \tan \left (e x +d \right ) a \,b^{4}+\frac {\left (-3 a^{4} b -2 a^{2} b^{3}+b^{5}\right ) \ln \left (1+\tan \left (e x +d \right )^{2}\right )}{2}+\left (a^{5}-2 a^{3} b^{2}-3 a \,b^{4}\right ) \arctan \left (\tan \left (e x +d \right )\right )}{e}\) \(173\)
default \(\frac {\frac {a^{4} b \tan \left (e x +d \right )^{4}}{4}+\frac {a^{5} \tan \left (e x +d \right )^{3}}{3}+\frac {4 a^{3} b^{2} \tan \left (e x +d \right )^{3}}{3}+\frac {3 a^{4} b \tan \left (e x +d \right )^{2}}{2}+3 a^{2} b^{3} \tan \left (e x +d \right )^{2}-\tan \left (e x +d \right ) a^{5}+2 \tan \left (e x +d \right ) a^{3} b^{2}+4 \tan \left (e x +d \right ) a \,b^{4}+\frac {\left (-3 a^{4} b -2 a^{2} b^{3}+b^{5}\right ) \ln \left (1+\tan \left (e x +d \right )^{2}\right )}{2}+\left (a^{5}-2 a^{3} b^{2}-3 a \,b^{4}\right ) \arctan \left (\tan \left (e x +d \right )\right )}{e}\) \(173\)
parallelrisch \(-\frac {-3 a^{4} b \tan \left (e x +d \right )^{4}-4 a^{5} \tan \left (e x +d \right )^{3}-16 a^{3} b^{2} \tan \left (e x +d \right )^{3}-12 a^{5} e x +24 a^{3} b^{2} e x +36 a \,b^{4} e x -18 a^{4} b \tan \left (e x +d \right )^{2}-36 a^{2} b^{3} \tan \left (e x +d \right )^{2}+18 \ln \left (1+\tan \left (e x +d \right )^{2}\right ) a^{4} b +12 \ln \left (1+\tan \left (e x +d \right )^{2}\right ) a^{2} b^{3}-6 \ln \left (1+\tan \left (e x +d \right )^{2}\right ) b^{5}+12 \tan \left (e x +d \right ) a^{5}-24 \tan \left (e x +d \right ) a^{3} b^{2}-48 \tan \left (e x +d \right ) a \,b^{4}}{12 e}\) \(194\)
parts \(a \,b^{4} x +\frac {\left (4 a^{2} b^{3}+b^{5}\right ) \ln \left (1+\tan \left (e x +d \right )^{2}\right )}{2 e}+\frac {\left (6 a^{3} b^{2}+4 a \,b^{4}\right ) \left (\tan \left (e x +d \right )-\arctan \left (\tan \left (e x +d \right )\right )\right )}{e}+\frac {\left (4 a^{4} b +6 a^{2} b^{3}\right ) \left (\frac {\tan \left (e x +d \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (e x +d \right )^{2}\right )}{2}\right )}{e}+\frac {\left (a^{5}+4 a^{3} b^{2}\right ) \left (\frac {\tan \left (e x +d \right )^{3}}{3}-\tan \left (e x +d \right )+\arctan \left (\tan \left (e x +d \right )\right )\right )}{e}+\frac {a^{4} b \left (\frac {\tan \left (e x +d \right )^{4}}{4}-\frac {\tan \left (e x +d \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (e x +d \right )^{2}\right )}{2}\right )}{e}\) \(198\)
risch \(-\frac {4 i a \left (3 a^{4} {\mathrm e}^{6 i \left (e x +d \right )}+3 a^{2} b^{2} {\mathrm e}^{6 i \left (e x +d \right )}-6 b^{4} {\mathrm e}^{6 i \left (e x +d \right )}+9 i a \,b^{3} {\mathrm e}^{6 i \left (e x +d \right )}+3 i a^{3} b \,{\mathrm e}^{2 i \left (e x +d \right )}+6 a^{4} {\mathrm e}^{4 i \left (e x +d \right )}-3 a^{2} b^{2} {\mathrm e}^{4 i \left (e x +d \right )}-18 b^{4} {\mathrm e}^{4 i \left (e x +d \right )}+9 i a^{3} b \,{\mathrm e}^{4 i \left (e x +d \right )}+9 i a \,b^{3} {\mathrm e}^{2 i \left (e x +d \right )}+5 a^{4} {\mathrm e}^{2 i \left (e x +d \right )}-7 a^{2} b^{2} {\mathrm e}^{2 i \left (e x +d \right )}-18 b^{4} {\mathrm e}^{2 i \left (e x +d \right )}+18 i a \,b^{3} {\mathrm e}^{4 i \left (e x +d \right )}+3 i a^{3} b \,{\mathrm e}^{6 i \left (e x +d \right )}+2 a^{4}-a^{2} b^{2}-6 b^{4}\right )}{3 e \left (1+{\mathrm e}^{2 i \left (e x +d \right )}\right )^{4}}-\frac {6 i b d \,a^{4}}{e}+i b^{5} x +a^{5} x -2 a^{3} b^{2} x -3 a \,b^{4} x -\frac {4 i b^{3} a^{2} d}{e}+\frac {2 i b^{5} d}{e}-3 i a^{4} b x -2 i a^{2} b^{3} x +\frac {3 b \ln \left (1+{\mathrm e}^{2 i \left (e x +d \right )}\right ) a^{4}}{e}+\frac {2 b^{3} \ln \left (1+{\mathrm e}^{2 i \left (e x +d \right )}\right ) a^{2}}{e}-\frac {b^{5} \ln \left (1+{\mathrm e}^{2 i \left (e x +d \right )}\right )}{e}\) \(416\)

input
int((a+b*tan(e*x+d))*(b^2+2*a*b*tan(e*x+d)+a^2*tan(e*x+d)^2)^2,x,method=_R 
ETURNVERBOSE)
 
output
(a^5-2*a^3*b^2-3*a*b^4)*x-a*(a^4-2*a^2*b^2-4*b^4)/e*tan(e*x+d)+1/3*a^3*(a^ 
2+4*b^2)/e*tan(e*x+d)^3+1/4*a^4*b/e*tan(e*x+d)^4+3/2*a^2*b*(a^2+2*b^2)/e*t 
an(e*x+d)^2-1/2*b*(3*a^4+2*a^2*b^2-b^4)/e*ln(1+tan(e*x+d)^2)
 
3.6.10.5 Fricas [A] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 149, normalized size of antiderivative = 1.03 \[ \int (a+b \tan (d+e x)) \left (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x)\right )^2 \, dx=\frac {3 \, a^{4} b \tan \left (e x + d\right )^{4} + 4 \, {\left (a^{5} + 4 \, a^{3} b^{2}\right )} \tan \left (e x + d\right )^{3} + 12 \, {\left (a^{5} - 2 \, a^{3} b^{2} - 3 \, a b^{4}\right )} e x + 18 \, {\left (a^{4} b + 2 \, a^{2} b^{3}\right )} \tan \left (e x + d\right )^{2} + 6 \, {\left (3 \, a^{4} b + 2 \, a^{2} b^{3} - b^{5}\right )} \log \left (\frac {1}{\tan \left (e x + d\right )^{2} + 1}\right ) - 12 \, {\left (a^{5} - 2 \, a^{3} b^{2} - 4 \, a b^{4}\right )} \tan \left (e x + d\right )}{12 \, e} \]

input
integrate((a+b*tan(e*x+d))*(b^2+2*a*b*tan(e*x+d)+a^2*tan(e*x+d)^2)^2,x, al 
gorithm="fricas")
 
output
1/12*(3*a^4*b*tan(e*x + d)^4 + 4*(a^5 + 4*a^3*b^2)*tan(e*x + d)^3 + 12*(a^ 
5 - 2*a^3*b^2 - 3*a*b^4)*e*x + 18*(a^4*b + 2*a^2*b^3)*tan(e*x + d)^2 + 6*( 
3*a^4*b + 2*a^2*b^3 - b^5)*log(1/(tan(e*x + d)^2 + 1)) - 12*(a^5 - 2*a^3*b 
^2 - 4*a*b^4)*tan(e*x + d))/e
 
3.6.10.6 Sympy [A] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 248, normalized size of antiderivative = 1.72 \[ \int (a+b \tan (d+e x)) \left (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x)\right )^2 \, dx=\begin {cases} a^{5} x + \frac {a^{5} \tan ^{3}{\left (d + e x \right )}}{3 e} - \frac {a^{5} \tan {\left (d + e x \right )}}{e} - \frac {3 a^{4} b \log {\left (\tan ^{2}{\left (d + e x \right )} + 1 \right )}}{2 e} + \frac {a^{4} b \tan ^{4}{\left (d + e x \right )}}{4 e} + \frac {3 a^{4} b \tan ^{2}{\left (d + e x \right )}}{2 e} - 2 a^{3} b^{2} x + \frac {4 a^{3} b^{2} \tan ^{3}{\left (d + e x \right )}}{3 e} + \frac {2 a^{3} b^{2} \tan {\left (d + e x \right )}}{e} - \frac {a^{2} b^{3} \log {\left (\tan ^{2}{\left (d + e x \right )} + 1 \right )}}{e} + \frac {3 a^{2} b^{3} \tan ^{2}{\left (d + e x \right )}}{e} - 3 a b^{4} x + \frac {4 a b^{4} \tan {\left (d + e x \right )}}{e} + \frac {b^{5} \log {\left (\tan ^{2}{\left (d + e x \right )} + 1 \right )}}{2 e} & \text {for}\: e \neq 0 \\x \left (a + b \tan {\left (d \right )}\right ) \left (a^{2} \tan ^{2}{\left (d \right )} + 2 a b \tan {\left (d \right )} + b^{2}\right )^{2} & \text {otherwise} \end {cases} \]

input
integrate((a+b*tan(e*x+d))*(b**2+2*a*b*tan(e*x+d)+a**2*tan(e*x+d)**2)**2,x 
)
 
output
Piecewise((a**5*x + a**5*tan(d + e*x)**3/(3*e) - a**5*tan(d + e*x)/e - 3*a 
**4*b*log(tan(d + e*x)**2 + 1)/(2*e) + a**4*b*tan(d + e*x)**4/(4*e) + 3*a* 
*4*b*tan(d + e*x)**2/(2*e) - 2*a**3*b**2*x + 4*a**3*b**2*tan(d + e*x)**3/( 
3*e) + 2*a**3*b**2*tan(d + e*x)/e - a**2*b**3*log(tan(d + e*x)**2 + 1)/e + 
 3*a**2*b**3*tan(d + e*x)**2/e - 3*a*b**4*x + 4*a*b**4*tan(d + e*x)/e + b* 
*5*log(tan(d + e*x)**2 + 1)/(2*e), Ne(e, 0)), (x*(a + b*tan(d))*(a**2*tan( 
d)**2 + 2*a*b*tan(d) + b**2)**2, True))
 
3.6.10.7 Maxima [A] (verification not implemented)

Time = 0.31 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.04 \[ \int (a+b \tan (d+e x)) \left (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x)\right )^2 \, dx=\frac {3 \, a^{4} b \tan \left (e x + d\right )^{4} + 4 \, {\left (a^{5} + 4 \, a^{3} b^{2}\right )} \tan \left (e x + d\right )^{3} + 18 \, {\left (a^{4} b + 2 \, a^{2} b^{3}\right )} \tan \left (e x + d\right )^{2} + 12 \, {\left (a^{5} - 2 \, a^{3} b^{2} - 3 \, a b^{4}\right )} {\left (e x + d\right )} - 6 \, {\left (3 \, a^{4} b + 2 \, a^{2} b^{3} - b^{5}\right )} \log \left (\tan \left (e x + d\right )^{2} + 1\right ) - 12 \, {\left (a^{5} - 2 \, a^{3} b^{2} - 4 \, a b^{4}\right )} \tan \left (e x + d\right )}{12 \, e} \]

input
integrate((a+b*tan(e*x+d))*(b^2+2*a*b*tan(e*x+d)+a^2*tan(e*x+d)^2)^2,x, al 
gorithm="maxima")
 
output
1/12*(3*a^4*b*tan(e*x + d)^4 + 4*(a^5 + 4*a^3*b^2)*tan(e*x + d)^3 + 18*(a^ 
4*b + 2*a^2*b^3)*tan(e*x + d)^2 + 12*(a^5 - 2*a^3*b^2 - 3*a*b^4)*(e*x + d) 
 - 6*(3*a^4*b + 2*a^2*b^3 - b^5)*log(tan(e*x + d)^2 + 1) - 12*(a^5 - 2*a^3 
*b^2 - 4*a*b^4)*tan(e*x + d))/e
 
3.6.10.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 2007 vs. \(2 (138) = 276\).

Time = 2.43 (sec) , antiderivative size = 2007, normalized size of antiderivative = 13.94 \[ \int (a+b \tan (d+e x)) \left (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x)\right )^2 \, dx=\text {Too large to display} \]

input
integrate((a+b*tan(e*x+d))*(b^2+2*a*b*tan(e*x+d)+a^2*tan(e*x+d)^2)^2,x, al 
gorithm="giac")
 
output
1/12*(12*a^5*e*x*tan(e*x)^4*tan(d)^4 - 24*a^3*b^2*e*x*tan(e*x)^4*tan(d)^4 
- 36*a*b^4*e*x*tan(e*x)^4*tan(d)^4 + 18*a^4*b*log(4*(tan(e*x)^2*tan(d)^2 - 
 2*tan(e*x)*tan(d) + 1)/(tan(e*x)^2*tan(d)^2 + tan(e*x)^2 + tan(d)^2 + 1)) 
*tan(e*x)^4*tan(d)^4 + 12*a^2*b^3*log(4*(tan(e*x)^2*tan(d)^2 - 2*tan(e*x)* 
tan(d) + 1)/(tan(e*x)^2*tan(d)^2 + tan(e*x)^2 + tan(d)^2 + 1))*tan(e*x)^4* 
tan(d)^4 - 6*b^5*log(4*(tan(e*x)^2*tan(d)^2 - 2*tan(e*x)*tan(d) + 1)/(tan( 
e*x)^2*tan(d)^2 + tan(e*x)^2 + tan(d)^2 + 1))*tan(e*x)^4*tan(d)^4 - 48*a^5 
*e*x*tan(e*x)^3*tan(d)^3 + 96*a^3*b^2*e*x*tan(e*x)^3*tan(d)^3 + 144*a*b^4* 
e*x*tan(e*x)^3*tan(d)^3 + 15*a^4*b*tan(e*x)^4*tan(d)^4 + 36*a^2*b^3*tan(e* 
x)^4*tan(d)^4 - 72*a^4*b*log(4*(tan(e*x)^2*tan(d)^2 - 2*tan(e*x)*tan(d) + 
1)/(tan(e*x)^2*tan(d)^2 + tan(e*x)^2 + tan(d)^2 + 1))*tan(e*x)^3*tan(d)^3 
- 48*a^2*b^3*log(4*(tan(e*x)^2*tan(d)^2 - 2*tan(e*x)*tan(d) + 1)/(tan(e*x) 
^2*tan(d)^2 + tan(e*x)^2 + tan(d)^2 + 1))*tan(e*x)^3*tan(d)^3 + 24*b^5*log 
(4*(tan(e*x)^2*tan(d)^2 - 2*tan(e*x)*tan(d) + 1)/(tan(e*x)^2*tan(d)^2 + ta 
n(e*x)^2 + tan(d)^2 + 1))*tan(e*x)^3*tan(d)^3 + 12*a^5*tan(e*x)^4*tan(d)^3 
 - 24*a^3*b^2*tan(e*x)^4*tan(d)^3 - 48*a*b^4*tan(e*x)^4*tan(d)^3 + 12*a^5* 
tan(e*x)^3*tan(d)^4 - 24*a^3*b^2*tan(e*x)^3*tan(d)^4 - 48*a*b^4*tan(e*x)^3 
*tan(d)^4 + 72*a^5*e*x*tan(e*x)^2*tan(d)^2 - 144*a^3*b^2*e*x*tan(e*x)^2*ta 
n(d)^2 - 216*a*b^4*e*x*tan(e*x)^2*tan(d)^2 + 18*a^4*b*tan(e*x)^4*tan(d)^2 
+ 36*a^2*b^3*tan(e*x)^4*tan(d)^2 - 24*a^4*b*tan(e*x)^3*tan(d)^3 - 72*a^...
 
3.6.10.9 Mupad [B] (verification not implemented)

Time = 27.08 (sec) , antiderivative size = 205, normalized size of antiderivative = 1.42 \[ \int (a+b \tan (d+e x)) \left (b^2+2 a b \tan (d+e x)+a^2 \tan ^2(d+e x)\right )^2 \, dx=\frac {{\mathrm {tan}\left (d+e\,x\right )}^3\,\left (\frac {a^5}{3}+\frac {4\,a^3\,b^2}{3}\right )}{e}+\frac {\mathrm {tan}\left (d+e\,x\right )\,\left (-a^5+2\,a^3\,b^2+4\,a\,b^4\right )}{e}-\frac {\ln \left ({\mathrm {tan}\left (d+e\,x\right )}^2+1\right )\,\left (\frac {3\,a^4\,b}{2}+a^2\,b^3-\frac {b^5}{2}\right )}{e}+\frac {{\mathrm {tan}\left (d+e\,x\right )}^2\,\left (\frac {3\,a^4\,b}{2}+3\,a^2\,b^3\right )}{e}+\frac {a^4\,b\,{\mathrm {tan}\left (d+e\,x\right )}^4}{4\,e}-\frac {a\,\mathrm {atan}\left (\frac {a\,\mathrm {tan}\left (d+e\,x\right )\,\left (a^2-3\,b^2\right )\,\left (a^2+b^2\right )}{-a^5+2\,a^3\,b^2+3\,a\,b^4}\right )\,\left (a^2-3\,b^2\right )\,\left (a^2+b^2\right )}{e} \]

input
int((a + b*tan(d + e*x))*(b^2 + a^2*tan(d + e*x)^2 + 2*a*b*tan(d + e*x))^2 
,x)
 
output
(tan(d + e*x)^3*(a^5/3 + (4*a^3*b^2)/3))/e + (tan(d + e*x)*(4*a*b^4 - a^5 
+ 2*a^3*b^2))/e - (log(tan(d + e*x)^2 + 1)*((3*a^4*b)/2 - b^5/2 + a^2*b^3) 
)/e + (tan(d + e*x)^2*((3*a^4*b)/2 + 3*a^2*b^3))/e + (a^4*b*tan(d + e*x)^4 
)/(4*e) - (a*atan((a*tan(d + e*x)*(a^2 - 3*b^2)*(a^2 + b^2))/(3*a*b^4 - a^ 
5 + 2*a^3*b^2))*(a^2 - 3*b^2)*(a^2 + b^2))/e