\(\int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx\) [1204]

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

Optimal result

Integrand size = 25, antiderivative size = 219 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=-\left (\left (b^2 c \left (c^2-3 d^2\right )+2 a b d \left (3 c^2-d^2\right )-a^2 \left (c^3-3 c d^2\right )\right ) x\right )-\frac {\left (2 a b c \left (c^2-3 d^2\right )-b^2 d \left (3 c^2-d^2\right )+a^2 \left (3 c^2 d-d^3\right )\right ) \log (\cos (e+f x))}{f}+\frac {2 d (b c+a d) (a c-b d) \tan (e+f x)}{f}+\frac {\left (2 a b c+a^2 d-b^2 d\right ) (c+d \tan (e+f x))^2}{2 f}+\frac {2 a b (c+d \tan (e+f x))^3}{3 f}+\frac {b^2 (c+d \tan (e+f x))^4}{4 d f} \] Output:

-(b^2*c*(c^2-3*d^2)+2*a*b*d*(3*c^2-d^2)-a^2*(c^3-3*c*d^2))*x-(2*a*b*c*(c^2 
-3*d^2)-b^2*d*(3*c^2-d^2)+a^2*(3*c^2*d-d^3))*ln(cos(f*x+e))/f+2*d*(a*d+b*c 
)*(a*c-b*d)*tan(f*x+e)/f+1/2*(a^2*d+2*a*b*c-b^2*d)*(c+d*tan(f*x+e))^2/f+2/ 
3*a*b*(c+d*tan(f*x+e))^3/f+1/4*b^2*(c+d*tan(f*x+e))^4/d/f
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.53 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.01 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=\frac {3 b^2 (c+d \tan (e+f x))^4-6 \left (2 a b c-a^2 d+b^2 d\right ) \left ((i c-d)^3 \log (i-\tan (e+f x))-(i c+d)^3 \log (i+\tan (e+f x))+6 c d^2 \tan (e+f x)+d^3 \tan ^2(e+f x)\right )-4 a b \left (3 i (c+i d)^4 \log (i-\tan (e+f x))-3 i (c-i d)^4 \log (i+\tan (e+f x))+6 d^2 \left (-6 c^2+d^2\right ) \tan (e+f x)-12 c d^3 \tan ^2(e+f x)-2 d^4 \tan ^3(e+f x)\right )}{12 d f} \] Input:

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

Output:

(3*b^2*(c + d*Tan[e + f*x])^4 - 6*(2*a*b*c - a^2*d + b^2*d)*((I*c - d)^3*L 
og[I - Tan[e + f*x]] - (I*c + d)^3*Log[I + Tan[e + f*x]] + 6*c*d^2*Tan[e + 
 f*x] + d^3*Tan[e + f*x]^2) - 4*a*b*((3*I)*(c + I*d)^4*Log[I - Tan[e + f*x 
]] - (3*I)*(c - I*d)^4*Log[I + Tan[e + f*x]] + 6*d^2*(-6*c^2 + d^2)*Tan[e 
+ f*x] - 12*c*d^3*Tan[e + f*x]^2 - 2*d^4*Tan[e + f*x]^3))/(12*d*f)
 

Rubi [A] (verified)

Time = 0.91 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.00, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, Rules used = {3042, 4026, 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 (e+f x))^2 (c+d \tan (e+f x))^3 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3dx\)

\(\Big \downarrow \) 4026

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

Input:

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

Output:

-((b^2*c*(c^2 - 3*d^2) + 2*a*b*d*(3*c^2 - d^2) - a^2*(c^3 - 3*c*d^2))*x) - 
 ((2*a*b*c*(c^2 - 3*d^2) - b^2*d*(3*c^2 - d^2) + a^2*(3*c^2*d - d^3))*Log[ 
Cos[e + f*x]])/f + (2*d*(b*c + a*d)*(a*c - b*d)*Tan[e + f*x])/f + ((2*a*b* 
c + a^2*d - b^2*d)*(c + d*Tan[e + f*x])^2)/(2*f) + (2*a*b*(c + d*Tan[e + f 
*x])^3)/(3*f) + (b^2*(c + d*Tan[e + f*x])^4)/(4*d*f)
 

Defintions of rubi rules used

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 4026
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^2, x_Symbol] :> Simp[d^2*((a + b*Tan[e + f*x])^(m + 1)/(b*f*( 
m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Simp[c^2 - d^2 + 2*c*d*Tan[e + f* 
x], x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && NeQ[b*c - a*d, 0] &&  !LeQ 
[m, -1] &&  !(EqQ[m, 2] && EqQ[a, 0])
 
Maple [A] (warning: unable to verify)

Time = 0.18 (sec) , antiderivative size = 232, normalized size of antiderivative = 1.06

method result size
parts \(a^{2} c^{3} x +\frac {\left (2 a b \,d^{3}+3 b^{2} c \,d^{2}\right ) \left (\frac {\tan \left (f x +e \right )^{3}}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (3 a^{2} c^{2} d +2 a b \,c^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (a^{2} d^{3}+6 a b c \,d^{2}+3 b^{2} c^{2} d \right ) \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}+\frac {\left (3 a^{2} c \,d^{2}+6 a b \,c^{2} d +b^{2} c^{3}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {b^{2} d^{3} \left (\frac {\tan \left (f x +e \right )^{4}}{4}-\frac {\tan \left (f x +e \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}\) \(232\)
norman \(\left (a^{2} c^{3}-3 a^{2} c \,d^{2}-6 a b \,c^{2} d +2 a b \,d^{3}-b^{2} c^{3}+3 b^{2} c \,d^{2}\right ) x +\frac {\left (3 a^{2} c \,d^{2}+6 a b \,c^{2} d -2 a b \,d^{3}+b^{2} c^{3}-3 b^{2} c \,d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {b^{2} d^{3} \tan \left (f x +e \right )^{4}}{4 f}+\frac {d \left (a^{2} d^{2}+6 a b c d +3 b^{2} c^{2}-b^{2} d^{2}\right ) \tan \left (f x +e \right )^{2}}{2 f}+\frac {b \,d^{2} \left (2 a d +3 b c \right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {\left (3 a^{2} c^{2} d -a^{2} d^{3}+2 a b \,c^{3}-6 a b c \,d^{2}-3 b^{2} c^{2} d +b^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) \(258\)
derivativedivides \(\frac {\frac {b^{2} d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {2 a b \,d^{3} \tan \left (f x +e \right )^{3}}{3}+b^{2} c \,d^{2} \tan \left (f x +e \right )^{3}+\frac {a^{2} d^{3} \tan \left (f x +e \right )^{2}}{2}+3 a b c \,d^{2} \tan \left (f x +e \right )^{2}+\frac {3 b^{2} c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {b^{2} d^{3} \tan \left (f x +e \right )^{2}}{2}+3 \tan \left (f x +e \right ) a^{2} c \,d^{2}+6 \tan \left (f x +e \right ) a b \,c^{2} d -2 \tan \left (f x +e \right ) a b \,d^{3}+\tan \left (f x +e \right ) b^{2} c^{3}-3 \tan \left (f x +e \right ) b^{2} c \,d^{2}+\frac {\left (3 a^{2} c^{2} d -a^{2} d^{3}+2 a b \,c^{3}-6 a b c \,d^{2}-3 b^{2} c^{2} d +b^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{2} c^{3}-3 a^{2} c \,d^{2}-6 a b \,c^{2} d +2 a b \,d^{3}-b^{2} c^{3}+3 b^{2} c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(307\)
default \(\frac {\frac {b^{2} d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {2 a b \,d^{3} \tan \left (f x +e \right )^{3}}{3}+b^{2} c \,d^{2} \tan \left (f x +e \right )^{3}+\frac {a^{2} d^{3} \tan \left (f x +e \right )^{2}}{2}+3 a b c \,d^{2} \tan \left (f x +e \right )^{2}+\frac {3 b^{2} c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {b^{2} d^{3} \tan \left (f x +e \right )^{2}}{2}+3 \tan \left (f x +e \right ) a^{2} c \,d^{2}+6 \tan \left (f x +e \right ) a b \,c^{2} d -2 \tan \left (f x +e \right ) a b \,d^{3}+\tan \left (f x +e \right ) b^{2} c^{3}-3 \tan \left (f x +e \right ) b^{2} c \,d^{2}+\frac {\left (3 a^{2} c^{2} d -a^{2} d^{3}+2 a b \,c^{3}-6 a b c \,d^{2}-3 b^{2} c^{2} d +b^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{2} c^{3}-3 a^{2} c \,d^{2}-6 a b \,c^{2} d +2 a b \,d^{3}-b^{2} c^{3}+3 b^{2} c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(307\)
parallelrisch \(\frac {12 a^{2} c^{3} f x -12 b^{2} c^{3} f x -72 a b \,c^{2} d f x +8 a b \,d^{3} \tan \left (f x +e \right )^{3}+12 b^{2} c \,d^{2} \tan \left (f x +e \right )^{3}+18 b^{2} c^{2} d \tan \left (f x +e \right )^{2}+36 \tan \left (f x +e \right ) a^{2} c \,d^{2}-24 \tan \left (f x +e \right ) a b \,d^{3}-36 \tan \left (f x +e \right ) b^{2} c \,d^{2}-36 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a b c \,d^{2}+3 b^{2} d^{3} \tan \left (f x +e \right )^{4}+6 a^{2} d^{3} \tan \left (f x +e \right )^{2}-6 b^{2} d^{3} \tan \left (f x +e \right )^{2}+12 \tan \left (f x +e \right ) b^{2} c^{3}+36 a b c \,d^{2} \tan \left (f x +e \right )^{2}+72 \tan \left (f x +e \right ) a b \,c^{2} d -36 a^{2} c \,d^{2} f x +24 a b \,d^{3} f x +36 b^{2} c \,d^{2} f x +18 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} c^{2} d +12 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a b \,c^{3}-18 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b^{2} c^{2} d -6 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} d^{3}+6 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b^{2} d^{3}}{12 f}\) \(367\)
risch \(-\frac {6 i b^{2} c^{2} d e}{f}-3 a^{2} c \,d^{2} x +2 a b \,d^{3} x +3 b^{2} c \,d^{2} x -6 a b \,c^{2} d x +i b^{2} d^{3} x +a^{2} c^{3} x -\frac {2 i a^{2} d^{3} e}{f}+\frac {2 i b^{2} d^{3} e}{f}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a b \,c^{3}}{f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{2} c^{2} d}{f}+3 i a^{2} c^{2} d x +2 i a b \,c^{3} x -3 i b^{2} c^{2} d x -\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} c^{2} d}{f}+\frac {2 i \left (-8 a b \,d^{3}-12 b^{2} c \,d^{2}+3 b^{2} c^{3}+9 a^{2} c \,d^{2}+18 a b \,c^{2} d +54 a b \,c^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}+18 a b \,c^{2} d \,{\mathrm e}^{6 i \left (f x +e \right )}+54 a b \,c^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}-9 i b^{2} c^{2} d \,{\mathrm e}^{6 i \left (f x +e \right )}-18 i b^{2} c^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}-9 i b^{2} c^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}+27 a^{2} c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-20 a b \,d^{3} {\mathrm e}^{2 i \left (f x +e \right )}-36 b^{2} c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-24 a b \,d^{3} {\mathrm e}^{4 i \left (f x +e \right )}+9 a^{2} c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}-12 a b \,d^{3} {\mathrm e}^{6 i \left (f x +e \right )}-18 b^{2} c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}+27 a^{2} c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+6 i b^{2} d^{3} {\mathrm e}^{6 i \left (f x +e \right )}+6 i b^{2} d^{3} {\mathrm e}^{2 i \left (f x +e \right )}-3 i a^{2} d^{3} {\mathrm e}^{6 i \left (f x +e \right )}+6 i b^{2} d^{3} {\mathrm e}^{4 i \left (f x +e \right )}-3 i a^{2} d^{3} {\mathrm e}^{2 i \left (f x +e \right )}-6 i a^{2} d^{3} {\mathrm e}^{4 i \left (f x +e \right )}-30 b^{2} c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+9 b^{2} c^{3} {\mathrm e}^{4 i \left (f x +e \right )}+9 b^{2} c^{3} {\mathrm e}^{2 i \left (f x +e \right )}+3 b^{2} c^{3} {\mathrm e}^{6 i \left (f x +e \right )}-36 i a b c \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-18 i a b c \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-18 i a b c \,d^{2} {\mathrm e}^{6 i \left (f x +e \right )}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}-i a^{2} d^{3} x +\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} d^{3}}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{2} d^{3}}{f}-b^{2} c^{3} x +\frac {6 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a b c \,d^{2}}{f}-6 i a b c \,d^{2} x +\frac {6 i a^{2} c^{2} d e}{f}+\frac {4 i a b \,c^{3} e}{f}-\frac {12 i a b c \,d^{2} e}{f}\) \(872\)

Input:

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

Output:

a^2*c^3*x+(2*a*b*d^3+3*b^2*c*d^2)/f*(1/3*tan(f*x+e)^3-tan(f*x+e)+arctan(ta 
n(f*x+e)))+1/2*(3*a^2*c^2*d+2*a*b*c^3)/f*ln(1+tan(f*x+e)^2)+(a^2*d^3+6*a*b 
*c*d^2+3*b^2*c^2*d)/f*(1/2*tan(f*x+e)^2-1/2*ln(1+tan(f*x+e)^2))+(3*a^2*c*d 
^2+6*a*b*c^2*d+b^2*c^3)/f*(tan(f*x+e)-arctan(tan(f*x+e)))+b^2*d^3/f*(1/4*t 
an(f*x+e)^4-1/2*tan(f*x+e)^2+1/2*ln(1+tan(f*x+e)^2))
 

Fricas [A] (verification not implemented)

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

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

Output:

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

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 445 vs. \(2 (194) = 388\).

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

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

Output:

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

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.33 (sec) , antiderivative size = 350, normalized size of antiderivative = 1.60 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=\frac {{\left (a^{2} c^{3} - b^{2} c^{3} - 6 \, a b c^{2} d - 3 \, a^{2} c d^{2} + 3 \, b^{2} c d^{2} + 2 \, a b d^{3}\right )} {\left (f x + e\right )}}{f} + \frac {{\left (2 \, a b c^{3} + 3 \, a^{2} c^{2} d - 3 \, b^{2} c^{2} d - 6 \, a b c d^{2} - a^{2} d^{3} + b^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, f} + \frac {3 \, b^{2} d^{3} f^{3} \tan \left (f x + e\right )^{4} + 12 \, b^{2} c d^{2} f^{3} \tan \left (f x + e\right )^{3} + 8 \, a b d^{3} f^{3} \tan \left (f x + e\right )^{3} + 18 \, b^{2} c^{2} d f^{3} \tan \left (f x + e\right )^{2} + 36 \, a b c d^{2} f^{3} \tan \left (f x + e\right )^{2} + 6 \, a^{2} d^{3} f^{3} \tan \left (f x + e\right )^{2} - 6 \, b^{2} d^{3} f^{3} \tan \left (f x + e\right )^{2} + 12 \, b^{2} c^{3} f^{3} \tan \left (f x + e\right ) + 72 \, a b c^{2} d f^{3} \tan \left (f x + e\right ) + 36 \, a^{2} c d^{2} f^{3} \tan \left (f x + e\right ) - 36 \, b^{2} c d^{2} f^{3} \tan \left (f x + e\right ) - 24 \, a b d^{3} f^{3} \tan \left (f x + e\right )}{12 \, f^{4}} \] Input:

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

Output:

(a^2*c^3 - b^2*c^3 - 6*a*b*c^2*d - 3*a^2*c*d^2 + 3*b^2*c*d^2 + 2*a*b*d^3)* 
(f*x + e)/f + 1/2*(2*a*b*c^3 + 3*a^2*c^2*d - 3*b^2*c^2*d - 6*a*b*c*d^2 - a 
^2*d^3 + b^2*d^3)*log(tan(f*x + e)^2 + 1)/f + 1/12*(3*b^2*d^3*f^3*tan(f*x 
+ e)^4 + 12*b^2*c*d^2*f^3*tan(f*x + e)^3 + 8*a*b*d^3*f^3*tan(f*x + e)^3 + 
18*b^2*c^2*d*f^3*tan(f*x + e)^2 + 36*a*b*c*d^2*f^3*tan(f*x + e)^2 + 6*a^2* 
d^3*f^3*tan(f*x + e)^2 - 6*b^2*d^3*f^3*tan(f*x + e)^2 + 12*b^2*c^3*f^3*tan 
(f*x + e) + 72*a*b*c^2*d*f^3*tan(f*x + e) + 36*a^2*c*d^2*f^3*tan(f*x + e) 
- 36*b^2*c*d^2*f^3*tan(f*x + e) - 24*a*b*d^3*f^3*tan(f*x + e))/f^4
 

Mupad [B] (verification not implemented)

Time = 2.34 (sec) , antiderivative size = 259, normalized size of antiderivative = 1.18 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=x\,\left (a^2\,c^3-3\,a^2\,c\,d^2-6\,a\,b\,c^2\,d+2\,a\,b\,d^3-b^2\,c^3+3\,b^2\,c\,d^2\right )+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (b^2\,c^3-b\,d^2\,\left (2\,a\,d+3\,b\,c\right )+3\,a^2\,c\,d^2+6\,a\,b\,c^2\,d\right )}{f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (-\frac {3\,a^2\,c^2\,d}{2}+\frac {a^2\,d^3}{2}-a\,b\,c^3+3\,a\,b\,c\,d^2+\frac {3\,b^2\,c^2\,d}{2}-\frac {b^2\,d^3}{2}\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a^2\,d^3}{2}+3\,a\,b\,c\,d^2+\frac {3\,b^2\,c^2\,d}{2}-\frac {b^2\,d^3}{2}\right )}{f}+\frac {b^2\,d^3\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4\,f}+\frac {b\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (2\,a\,d+3\,b\,c\right )}{3\,f} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.23 (sec) , antiderivative size = 366, normalized size of antiderivative = 1.67 \[ \int (a+b \tan (e+f x))^2 (c+d \tan (e+f x))^3 \, dx=\frac {18 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{2} c^{2} d -6 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{2} d^{3}+12 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a b \,c^{3}-36 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a b c \,d^{2}-18 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) b^{2} c^{2} d +6 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) b^{2} d^{3}+3 \tan \left (f x +e \right )^{4} b^{2} d^{3}+8 \tan \left (f x +e \right )^{3} a b \,d^{3}+12 \tan \left (f x +e \right )^{3} b^{2} c \,d^{2}+6 \tan \left (f x +e \right )^{2} a^{2} d^{3}+36 \tan \left (f x +e \right )^{2} a b c \,d^{2}+18 \tan \left (f x +e \right )^{2} b^{2} c^{2} d -6 \tan \left (f x +e \right )^{2} b^{2} d^{3}+36 \tan \left (f x +e \right ) a^{2} c \,d^{2}+72 \tan \left (f x +e \right ) a b \,c^{2} d -24 \tan \left (f x +e \right ) a b \,d^{3}+12 \tan \left (f x +e \right ) b^{2} c^{3}-36 \tan \left (f x +e \right ) b^{2} c \,d^{2}+12 a^{2} c^{3} f x -36 a^{2} c \,d^{2} f x -72 a b \,c^{2} d f x +24 a b \,d^{3} f x -12 b^{2} c^{3} f x +36 b^{2} c \,d^{2} f x}{12 f} \] Input:

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

Output:

(18*log(tan(e + f*x)**2 + 1)*a**2*c**2*d - 6*log(tan(e + f*x)**2 + 1)*a**2 
*d**3 + 12*log(tan(e + f*x)**2 + 1)*a*b*c**3 - 36*log(tan(e + f*x)**2 + 1) 
*a*b*c*d**2 - 18*log(tan(e + f*x)**2 + 1)*b**2*c**2*d + 6*log(tan(e + f*x) 
**2 + 1)*b**2*d**3 + 3*tan(e + f*x)**4*b**2*d**3 + 8*tan(e + f*x)**3*a*b*d 
**3 + 12*tan(e + f*x)**3*b**2*c*d**2 + 6*tan(e + f*x)**2*a**2*d**3 + 36*ta 
n(e + f*x)**2*a*b*c*d**2 + 18*tan(e + f*x)**2*b**2*c**2*d - 6*tan(e + f*x) 
**2*b**2*d**3 + 36*tan(e + f*x)*a**2*c*d**2 + 72*tan(e + f*x)*a*b*c**2*d - 
 24*tan(e + f*x)*a*b*d**3 + 12*tan(e + f*x)*b**2*c**3 - 36*tan(e + f*x)*b* 
*2*c*d**2 + 12*a**2*c**3*f*x - 36*a**2*c*d**2*f*x - 72*a*b*c**2*d*f*x + 24 
*a*b*d**3*f*x - 12*b**2*c**3*f*x + 36*b**2*c*d**2*f*x)/(12*f)