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

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 = 302 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx=-\left ((a c-b d) \left (8 a b c d-a^2 \left (c^2-3 d^2\right )+b^2 \left (3 c^2-d^2\right )\right ) x\right )+\frac {(b c+a d) \left (8 a b c d+b^2 \left (c^2-3 d^2\right )-a^2 \left (3 c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {d \left (2 a^3 c d-6 a b^2 c d+3 a^2 b \left (c^2-d^2\right )-b^3 \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac {\left (3 a^2 b c-b^3 c+a^3 d-3 a b^2 d\right ) (c+d \tan (e+f x))^2}{2 f}+\frac {b \left (3 a^2-b^2\right ) (c+d \tan (e+f x))^3}{3 f}-\frac {b^2 (b c-11 a d) (c+d \tan (e+f x))^4}{20 d^2 f}+\frac {b^2 (a+b \tan (e+f x)) (c+d \tan (e+f x))^4}{5 d f} \] Output:

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

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 5.77 (sec) , antiderivative size = 281, normalized size of antiderivative = 0.93 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx=\frac {-\frac {3 b^2 (b c-11 a d) (c+d \tan (e+f x))^4}{d}+12 b^2 (a+b \tan (e+f x)) (c+d \tan (e+f x))^4-10 \left (3 \left (3 a^2 b c-b^3 c-a^3 d+3 a 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 )+b \left (3 a^2-b^2\right ) \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 )\right )}{60 d f} \] Input:

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

Output:

((-3*b^2*(b*c - 11*a*d)*(c + d*Tan[e + f*x])^4)/d + 12*b^2*(a + b*Tan[e + 
f*x])*(c + d*Tan[e + f*x])^4 - 10*(3*(3*a^2*b*c - b^3*c - a^3*d + 3*a*b^2* 
d)*((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[e + f*x]^2) + b*(3*a^2 - b^2)*((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)))/(60*d*f)
 

Rubi [A] (verified)

Time = 1.43 (sec) , antiderivative size = 322, normalized size of antiderivative = 1.07, number of steps used = 12, number of rules used = 12, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.480, Rules used = {3042, 4049, 3042, 4113, 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))^3 (c+d \tan (e+f x))^3 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4049

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4113

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

Input:

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

Output:

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

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 4049
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b^2*(a + b*Tan[e + f*x])^(m - 2)*((c 
+ d*Tan[e + f*x])^(n + 1)/(d*f*(m + n - 1))), x] + Simp[1/(d*(m + n - 1)) 
 Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + f*x])^n*Simp[a^3*d*(m + n 
- 1) - b^2*(b*c*(m - 2) + a*d*(1 + n)) + b*d*(m + n - 1)*(3*a^2 - b^2)*Tan[ 
e + f*x] - b^2*(b*c*(m - 2) - a*d*(3*m + 2*n - 4))*Tan[e + f*x]^2, x], x], 
x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2 
, 0] && NeQ[c^2 + d^2, 0] && IntegerQ[2*m] && GtQ[m, 2] && (GeQ[n, -1] || I 
ntegerQ[m]) &&  !(IGtQ[n, 2] && ( !IntegerQ[m] || (EqQ[c, 0] && NeQ[a, 0])) 
)
 

rule 4113
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) 
+ (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[C*((a + 
 b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e + f*x])^m*Si 
mp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && 
NeQ[A*b^2 - a*b*B + a^2*C, 0] &&  !LeQ[m, -1]
 
Maple [A] (warning: unable to verify)

Time = 0.23 (sec) , antiderivative size = 319, normalized size of antiderivative = 1.06

method result size
parts \(a^{3} c^{3} x +\frac {\left (3 a \,b^{2} d^{3}+3 b^{3} c \,d^{2}\right ) \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}+\frac {\left (3 a^{3} c^{2} d +3 a^{2} b \,c^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (3 a^{2} b \,d^{3}+9 a \,b^{2} c \,d^{2}+3 b^{3} c^{2} d \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^{3} c \,d^{2}+9 a^{2} b \,c^{2} d +3 a \,b^{2} c^{3}\right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (a^{3} d^{3}+9 a^{2} b c \,d^{2}+9 a \,b^{2} c^{2} d +b^{3} c^{3}\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 {b^{3} d^{3} \left (\frac {\tan \left (f x +e \right )^{5}}{5}-\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}\) \(319\)
norman \(\left (a^{3} c^{3}-3 a^{3} c \,d^{2}-9 a^{2} b \,c^{2} d +3 a^{2} b \,d^{3}-3 a \,b^{2} c^{3}+9 a \,b^{2} c \,d^{2}+3 b^{3} c^{2} d -b^{3} d^{3}\right ) x +\frac {\left (3 a^{3} c \,d^{2}+9 a^{2} b \,c^{2} d -3 a^{2} b \,d^{3}+3 a \,b^{2} c^{3}-9 a \,b^{2} c \,d^{2}-3 b^{3} c^{2} d +b^{3} d^{3}\right ) \tan \left (f x +e \right )}{f}+\frac {\left (a^{3} d^{3}+9 a^{2} b c \,d^{2}+9 a \,b^{2} c^{2} d -3 a \,b^{2} d^{3}+b^{3} c^{3}-3 b^{3} c \,d^{2}\right ) \tan \left (f x +e \right )^{2}}{2 f}+\frac {b^{3} d^{3} \tan \left (f x +e \right )^{5}}{5 f}+\frac {b d \left (3 a^{2} d^{2}+9 a b c d +3 b^{2} c^{2}-b^{2} d^{2}\right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {3 b^{2} d^{2} \left (a d +b c \right ) \tan \left (f x +e \right )^{4}}{4 f}+\frac {\left (3 a^{3} c^{2} d -a^{3} d^{3}+3 a^{2} b \,c^{3}-9 a^{2} b c \,d^{2}-9 a \,b^{2} c^{2} d +3 a \,b^{2} d^{3}-b^{3} c^{3}+3 b^{3} c \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}\) \(396\)
derivativedivides \(\frac {\frac {b^{3} d^{3} \tan \left (f x +e \right )^{5}}{5}+\frac {3 a \,b^{2} d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {3 b^{3} c \,d^{2} \tan \left (f x +e \right )^{4}}{4}+a^{2} b \,d^{3} \tan \left (f x +e \right )^{3}+3 a \,b^{2} c \,d^{2} \tan \left (f x +e \right )^{3}+b^{3} c^{2} d \tan \left (f x +e \right )^{3}-\frac {b^{3} d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {\tan \left (f x +e \right )^{2} a^{3} d^{3}}{2}+\frac {9 a^{2} b c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\frac {9 a \,b^{2} c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {3 a \,b^{2} d^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {b^{3} c^{3} \tan \left (f x +e \right )^{2}}{2}-\frac {3 b^{3} c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+3 \tan \left (f x +e \right ) a^{3} c \,d^{2}+9 \tan \left (f x +e \right ) a^{2} b \,c^{2} d -3 \tan \left (f x +e \right ) a^{2} b \,d^{3}+3 \tan \left (f x +e \right ) a \,b^{2} c^{3}-9 \tan \left (f x +e \right ) a \,b^{2} c \,d^{2}-3 \tan \left (f x +e \right ) b^{3} c^{2} d +\tan \left (f x +e \right ) b^{3} d^{3}+\frac {\left (3 a^{3} c^{2} d -a^{3} d^{3}+3 a^{2} b \,c^{3}-9 a^{2} b c \,d^{2}-9 a \,b^{2} c^{2} d +3 a \,b^{2} d^{3}-b^{3} c^{3}+3 b^{3} c \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{3} c^{3}-3 a^{3} c \,d^{2}-9 a^{2} b \,c^{2} d +3 a^{2} b \,d^{3}-3 a \,b^{2} c^{3}+9 a \,b^{2} c \,d^{2}+3 b^{3} c^{2} d -b^{3} d^{3}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(495\)
default \(\frac {\frac {b^{3} d^{3} \tan \left (f x +e \right )^{5}}{5}+\frac {3 a \,b^{2} d^{3} \tan \left (f x +e \right )^{4}}{4}+\frac {3 b^{3} c \,d^{2} \tan \left (f x +e \right )^{4}}{4}+a^{2} b \,d^{3} \tan \left (f x +e \right )^{3}+3 a \,b^{2} c \,d^{2} \tan \left (f x +e \right )^{3}+b^{3} c^{2} d \tan \left (f x +e \right )^{3}-\frac {b^{3} d^{3} \tan \left (f x +e \right )^{3}}{3}+\frac {\tan \left (f x +e \right )^{2} a^{3} d^{3}}{2}+\frac {9 a^{2} b c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+\frac {9 a \,b^{2} c^{2} d \tan \left (f x +e \right )^{2}}{2}-\frac {3 a \,b^{2} d^{3} \tan \left (f x +e \right )^{2}}{2}+\frac {b^{3} c^{3} \tan \left (f x +e \right )^{2}}{2}-\frac {3 b^{3} c \,d^{2} \tan \left (f x +e \right )^{2}}{2}+3 \tan \left (f x +e \right ) a^{3} c \,d^{2}+9 \tan \left (f x +e \right ) a^{2} b \,c^{2} d -3 \tan \left (f x +e \right ) a^{2} b \,d^{3}+3 \tan \left (f x +e \right ) a \,b^{2} c^{3}-9 \tan \left (f x +e \right ) a \,b^{2} c \,d^{2}-3 \tan \left (f x +e \right ) b^{3} c^{2} d +\tan \left (f x +e \right ) b^{3} d^{3}+\frac {\left (3 a^{3} c^{2} d -a^{3} d^{3}+3 a^{2} b \,c^{3}-9 a^{2} b c \,d^{2}-9 a \,b^{2} c^{2} d +3 a \,b^{2} d^{3}-b^{3} c^{3}+3 b^{3} c \,d^{2}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{3} c^{3}-3 a^{3} c \,d^{2}-9 a^{2} b \,c^{2} d +3 a^{2} b \,d^{3}-3 a \,b^{2} c^{3}+9 a \,b^{2} c \,d^{2}+3 b^{3} c^{2} d -b^{3} d^{3}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(495\)
parallelrisch \(\frac {180 a^{2} b \,d^{3} f x -180 a \,b^{2} c^{3} f x +180 b^{3} c^{2} d f x +45 a \,b^{2} d^{3} \tan \left (f x +e \right )^{4}+45 b^{3} c \,d^{2} \tan \left (f x +e \right )^{4}+60 a^{2} b \,d^{3} \tan \left (f x +e \right )^{3}+60 b^{3} c^{2} d \tan \left (f x +e \right )^{3}-90 a \,b^{2} d^{3} \tan \left (f x +e \right )^{2}-90 b^{3} c \,d^{2} \tan \left (f x +e \right )^{2}-180 \tan \left (f x +e \right ) a^{2} b \,d^{3}+180 \tan \left (f x +e \right ) a \,b^{2} c^{3}-180 \tan \left (f x +e \right ) b^{3} c^{2} d +60 x \,a^{3} c^{3} f +90 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} c^{2} d +60 \tan \left (f x +e \right ) b^{3} d^{3}+12 b^{3} d^{3} \tan \left (f x +e \right )^{5}-20 b^{3} d^{3} \tan \left (f x +e \right )^{3}+30 b^{3} c^{3} \tan \left (f x +e \right )^{2}+180 a \,b^{2} c \,d^{2} \tan \left (f x +e \right )^{3}+270 a^{2} b c \,d^{2} \tan \left (f x +e \right )^{2}+270 a \,b^{2} c^{2} d \tan \left (f x +e \right )^{2}+540 \tan \left (f x +e \right ) a^{2} b \,c^{2} d -540 \tan \left (f x +e \right ) a \,b^{2} c \,d^{2}-60 b^{3} d^{3} f x +90 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} b \,c^{3}+90 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,b^{2} d^{3}+90 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b^{3} c \,d^{2}+180 \tan \left (f x +e \right ) a^{3} c \,d^{2}-270 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} b c \,d^{2}-270 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,b^{2} c^{2} d -540 a^{2} b \,c^{2} d f x +540 a \,b^{2} c \,d^{2} f x -180 x \,a^{3} c \,d^{2} f +30 \tan \left (f x +e \right )^{2} a^{3} d^{3}-30 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} d^{3}-30 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) b^{3} c^{3}}{60 f}\) \(581\)
risch \(\text {Expression too large to display}\) \(1519\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

Time = 0.10 (sec) , antiderivative size = 374, normalized size of antiderivative = 1.24 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx=\frac {12 \, b^{3} d^{3} \tan \left (f x + e\right )^{5} + 45 \, {\left (b^{3} c d^{2} + a b^{2} d^{3}\right )} \tan \left (f x + e\right )^{4} + 20 \, {\left (3 \, b^{3} c^{2} d + 9 \, a b^{2} c d^{2} + {\left (3 \, a^{2} b - b^{3}\right )} d^{3}\right )} \tan \left (f x + e\right )^{3} + 60 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c^{3} - 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c^{2} d - 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d^{2} + {\left (3 \, a^{2} b - b^{3}\right )} d^{3}\right )} f x + 30 \, {\left (b^{3} c^{3} + 9 \, a b^{2} c^{2} d + 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c d^{2} + {\left (a^{3} - 3 \, a b^{2}\right )} d^{3}\right )} \tan \left (f x + e\right )^{2} - 30 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{3} + 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} c^{2} d - 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c d^{2} - {\left (a^{3} - 3 \, a b^{2}\right )} d^{3}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 60 \, {\left (3 \, a b^{2} c^{3} + 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c^{2} d + 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d^{2} - {\left (3 \, a^{2} b - b^{3}\right )} d^{3}\right )} \tan \left (f x + e\right )}{60 \, f} \] Input:

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

Output:

1/60*(12*b^3*d^3*tan(f*x + e)^5 + 45*(b^3*c*d^2 + a*b^2*d^3)*tan(f*x + e)^ 
4 + 20*(3*b^3*c^2*d + 9*a*b^2*c*d^2 + (3*a^2*b - b^3)*d^3)*tan(f*x + e)^3 
+ 60*((a^3 - 3*a*b^2)*c^3 - 3*(3*a^2*b - b^3)*c^2*d - 3*(a^3 - 3*a*b^2)*c* 
d^2 + (3*a^2*b - b^3)*d^3)*f*x + 30*(b^3*c^3 + 9*a*b^2*c^2*d + 3*(3*a^2*b 
- b^3)*c*d^2 + (a^3 - 3*a*b^2)*d^3)*tan(f*x + e)^2 - 30*((3*a^2*b - b^3)*c 
^3 + 3*(a^3 - 3*a*b^2)*c^2*d - 3*(3*a^2*b - b^3)*c*d^2 - (a^3 - 3*a*b^2)*d 
^3)*log(1/(tan(f*x + e)^2 + 1)) + 60*(3*a*b^2*c^3 + 3*(3*a^2*b - b^3)*c^2* 
d + 3*(a^3 - 3*a*b^2)*c*d^2 - (3*a^2*b - b^3)*d^3)*tan(f*x + e))/f
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 711 vs. \(2 (275) = 550\).

Time = 0.27 (sec) , antiderivative size = 711, normalized size of antiderivative = 2.35 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx =\text {Too large to display} \] Input:

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

Output:

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

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 375, normalized size of antiderivative = 1.24 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx=\frac {12 \, b^{3} d^{3} \tan \left (f x + e\right )^{5} + 45 \, {\left (b^{3} c d^{2} + a b^{2} d^{3}\right )} \tan \left (f x + e\right )^{4} + 20 \, {\left (3 \, b^{3} c^{2} d + 9 \, a b^{2} c d^{2} + {\left (3 \, a^{2} b - b^{3}\right )} d^{3}\right )} \tan \left (f x + e\right )^{3} + 30 \, {\left (b^{3} c^{3} + 9 \, a b^{2} c^{2} d + 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c d^{2} + {\left (a^{3} - 3 \, a b^{2}\right )} d^{3}\right )} \tan \left (f x + e\right )^{2} + 60 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c^{3} - 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c^{2} d - 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d^{2} + {\left (3 \, a^{2} b - b^{3}\right )} d^{3}\right )} {\left (f x + e\right )} + 30 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c^{3} + 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} c^{2} d - 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c d^{2} - {\left (a^{3} - 3 \, a b^{2}\right )} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 60 \, {\left (3 \, a b^{2} c^{3} + 3 \, {\left (3 \, a^{2} b - b^{3}\right )} c^{2} d + 3 \, {\left (a^{3} - 3 \, a b^{2}\right )} c d^{2} - {\left (3 \, a^{2} b - b^{3}\right )} d^{3}\right )} \tan \left (f x + e\right )}{60 \, f} \] Input:

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

Output:

1/60*(12*b^3*d^3*tan(f*x + e)^5 + 45*(b^3*c*d^2 + a*b^2*d^3)*tan(f*x + e)^ 
4 + 20*(3*b^3*c^2*d + 9*a*b^2*c*d^2 + (3*a^2*b - b^3)*d^3)*tan(f*x + e)^3 
+ 30*(b^3*c^3 + 9*a*b^2*c^2*d + 3*(3*a^2*b - b^3)*c*d^2 + (a^3 - 3*a*b^2)* 
d^3)*tan(f*x + e)^2 + 60*((a^3 - 3*a*b^2)*c^3 - 3*(3*a^2*b - b^3)*c^2*d - 
3*(a^3 - 3*a*b^2)*c*d^2 + (3*a^2*b - b^3)*d^3)*(f*x + e) + 30*((3*a^2*b - 
b^3)*c^3 + 3*(a^3 - 3*a*b^2)*c^2*d - 3*(3*a^2*b - b^3)*c*d^2 - (a^3 - 3*a* 
b^2)*d^3)*log(tan(f*x + e)^2 + 1) + 60*(3*a*b^2*c^3 + 3*(3*a^2*b - b^3)*c^ 
2*d + 3*(a^3 - 3*a*b^2)*c*d^2 - (3*a^2*b - b^3)*d^3)*tan(f*x + e))/f
 

Giac [A] (verification not implemented)

Time = 0.44 (sec) , antiderivative size = 563, normalized size of antiderivative = 1.86 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx=\frac {{\left (a^{3} c^{3} - 3 \, a b^{2} c^{3} - 9 \, a^{2} b c^{2} d + 3 \, b^{3} c^{2} d - 3 \, a^{3} c d^{2} + 9 \, a b^{2} c d^{2} + 3 \, a^{2} b d^{3} - b^{3} d^{3}\right )} {\left (f x + e\right )}}{f} + \frac {{\left (3 \, a^{2} b c^{3} - b^{3} c^{3} + 3 \, a^{3} c^{2} d - 9 \, a b^{2} c^{2} d - 9 \, a^{2} b c d^{2} + 3 \, b^{3} c d^{2} - a^{3} d^{3} + 3 \, a b^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, f} + \frac {12 \, b^{3} d^{3} f^{4} \tan \left (f x + e\right )^{5} + 45 \, b^{3} c d^{2} f^{4} \tan \left (f x + e\right )^{4} + 45 \, a b^{2} d^{3} f^{4} \tan \left (f x + e\right )^{4} + 60 \, b^{3} c^{2} d f^{4} \tan \left (f x + e\right )^{3} + 180 \, a b^{2} c d^{2} f^{4} \tan \left (f x + e\right )^{3} + 60 \, a^{2} b d^{3} f^{4} \tan \left (f x + e\right )^{3} - 20 \, b^{3} d^{3} f^{4} \tan \left (f x + e\right )^{3} + 30 \, b^{3} c^{3} f^{4} \tan \left (f x + e\right )^{2} + 270 \, a b^{2} c^{2} d f^{4} \tan \left (f x + e\right )^{2} + 270 \, a^{2} b c d^{2} f^{4} \tan \left (f x + e\right )^{2} - 90 \, b^{3} c d^{2} f^{4} \tan \left (f x + e\right )^{2} + 30 \, a^{3} d^{3} f^{4} \tan \left (f x + e\right )^{2} - 90 \, a b^{2} d^{3} f^{4} \tan \left (f x + e\right )^{2} + 180 \, a b^{2} c^{3} f^{4} \tan \left (f x + e\right ) + 540 \, a^{2} b c^{2} d f^{4} \tan \left (f x + e\right ) - 180 \, b^{3} c^{2} d f^{4} \tan \left (f x + e\right ) + 180 \, a^{3} c d^{2} f^{4} \tan \left (f x + e\right ) - 540 \, a b^{2} c d^{2} f^{4} \tan \left (f x + e\right ) - 180 \, a^{2} b d^{3} f^{4} \tan \left (f x + e\right ) + 60 \, b^{3} d^{3} f^{4} \tan \left (f x + e\right )}{60 \, f^{5}} \] Input:

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

Output:

(a^3*c^3 - 3*a*b^2*c^3 - 9*a^2*b*c^2*d + 3*b^3*c^2*d - 3*a^3*c*d^2 + 9*a*b 
^2*c*d^2 + 3*a^2*b*d^3 - b^3*d^3)*(f*x + e)/f + 1/2*(3*a^2*b*c^3 - b^3*c^3 
 + 3*a^3*c^2*d - 9*a*b^2*c^2*d - 9*a^2*b*c*d^2 + 3*b^3*c*d^2 - a^3*d^3 + 3 
*a*b^2*d^3)*log(tan(f*x + e)^2 + 1)/f + 1/60*(12*b^3*d^3*f^4*tan(f*x + e)^ 
5 + 45*b^3*c*d^2*f^4*tan(f*x + e)^4 + 45*a*b^2*d^3*f^4*tan(f*x + e)^4 + 60 
*b^3*c^2*d*f^4*tan(f*x + e)^3 + 180*a*b^2*c*d^2*f^4*tan(f*x + e)^3 + 60*a^ 
2*b*d^3*f^4*tan(f*x + e)^3 - 20*b^3*d^3*f^4*tan(f*x + e)^3 + 30*b^3*c^3*f^ 
4*tan(f*x + e)^2 + 270*a*b^2*c^2*d*f^4*tan(f*x + e)^2 + 270*a^2*b*c*d^2*f^ 
4*tan(f*x + e)^2 - 90*b^3*c*d^2*f^4*tan(f*x + e)^2 + 30*a^3*d^3*f^4*tan(f* 
x + e)^2 - 90*a*b^2*d^3*f^4*tan(f*x + e)^2 + 180*a*b^2*c^3*f^4*tan(f*x + e 
) + 540*a^2*b*c^2*d*f^4*tan(f*x + e) - 180*b^3*c^2*d*f^4*tan(f*x + e) + 18 
0*a^3*c*d^2*f^4*tan(f*x + e) - 540*a*b^2*c*d^2*f^4*tan(f*x + e) - 180*a^2* 
b*d^3*f^4*tan(f*x + e) + 60*b^3*d^3*f^4*tan(f*x + e))/f^5
 

Mupad [B] (verification not implemented)

Time = 2.44 (sec) , antiderivative size = 494, normalized size of antiderivative = 1.64 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx=\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (b^3\,d^3+3\,a\,c\,\left (a^2\,d^2+3\,a\,b\,c\,d+b^2\,c^2\right )-3\,b\,d\,\left (a^2\,d^2+3\,a\,b\,c\,d+b^2\,c^2\right )\right )}{f}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (-\frac {3\,a^3\,c^2\,d}{2}+\frac {a^3\,d^3}{2}-\frac {3\,a^2\,b\,c^3}{2}+\frac {9\,a^2\,b\,c\,d^2}{2}+\frac {9\,a\,b^2\,c^2\,d}{2}-\frac {3\,a\,b^2\,d^3}{2}+\frac {b^3\,c^3}{2}-\frac {3\,b^3\,c\,d^2}{2}\right )}{f}-\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {b^3\,d^3}{3}-b\,d\,\left (a^2\,d^2+3\,a\,b\,c\,d+b^2\,c^2\right )\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {a^3\,d^3}{2}+\frac {b^3\,c^3}{2}-\frac {3\,b^2\,d^2\,\left (a\,d+b\,c\right )}{2}+\frac {9\,a\,b^2\,c^2\,d}{2}+\frac {9\,a^2\,b\,c\,d^2}{2}\right )}{f}+\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a\,c-b\,d\right )\,\left (-a^2\,c^2+3\,a^2\,d^2+8\,a\,b\,c\,d+3\,b^2\,c^2-b^2\,d^2\right )}{a^3\,c^3-3\,a^3\,c\,d^2-9\,a^2\,b\,c^2\,d+3\,a^2\,b\,d^3-3\,a\,b^2\,c^3+9\,a\,b^2\,c\,d^2+3\,b^3\,c^2\,d-b^3\,d^3}\right )\,\left (a\,c-b\,d\right )\,\left (-a^2\,c^2+3\,a^2\,d^2+8\,a\,b\,c\,d+3\,b^2\,c^2-b^2\,d^2\right )}{f}+\frac {b^3\,d^3\,{\mathrm {tan}\left (e+f\,x\right )}^5}{5\,f}+\frac {3\,b^2\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^4\,\left (a\,d+b\,c\right )}{4\,f} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.19 (sec) , antiderivative size = 580, normalized size of antiderivative = 1.92 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))^3 \, dx=\frac {-270 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{2} b c \,d^{2}-270 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a \,b^{2} c^{2} d +180 \tan \left (f x +e \right )^{3} a \,b^{2} c \,d^{2}+270 \tan \left (f x +e \right )^{2} a^{2} b c \,d^{2}+270 \tan \left (f x +e \right )^{2} a \,b^{2} c^{2} d +90 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{3} c^{2} d +90 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{2} b \,c^{3}+90 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a \,b^{2} d^{3}+90 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) b^{3} c \,d^{2}+45 \tan \left (f x +e \right )^{4} a \,b^{2} d^{3}+45 \tan \left (f x +e \right )^{4} b^{3} c \,d^{2}+60 \tan \left (f x +e \right )^{3} a^{2} b \,d^{3}+60 \tan \left (f x +e \right )^{3} b^{3} c^{2} d -90 \tan \left (f x +e \right )^{2} a \,b^{2} d^{3}-90 \tan \left (f x +e \right )^{2} b^{3} c \,d^{2}+180 \tan \left (f x +e \right ) a^{3} c \,d^{2}-180 \tan \left (f x +e \right ) a^{2} b \,d^{3}+180 \tan \left (f x +e \right ) a \,b^{2} c^{3}-180 \tan \left (f x +e \right ) b^{3} c^{2} d +60 a^{3} c^{3} f x -60 b^{3} d^{3} f x -540 a^{2} b \,c^{2} d f x +540 a \,b^{2} c \,d^{2} f x +540 \tan \left (f x +e \right ) a^{2} b \,c^{2} d -540 \tan \left (f x +e \right ) a \,b^{2} c \,d^{2}-180 a^{3} c \,d^{2} f x +180 a^{2} b \,d^{3} f x -180 a \,b^{2} c^{3} f x +180 b^{3} c^{2} d f x -30 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) a^{3} d^{3}-30 \,\mathrm {log}\left (\tan \left (f x +e \right )^{2}+1\right ) b^{3} c^{3}+12 \tan \left (f x +e \right )^{5} b^{3} d^{3}-20 \tan \left (f x +e \right )^{3} b^{3} d^{3}+30 \tan \left (f x +e \right )^{2} a^{3} d^{3}+30 \tan \left (f x +e \right )^{2} b^{3} c^{3}+60 \tan \left (f x +e \right ) b^{3} d^{3}}{60 f} \] Input:

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

Output:

(90*log(tan(e + f*x)**2 + 1)*a**3*c**2*d - 30*log(tan(e + f*x)**2 + 1)*a** 
3*d**3 + 90*log(tan(e + f*x)**2 + 1)*a**2*b*c**3 - 270*log(tan(e + f*x)**2 
 + 1)*a**2*b*c*d**2 - 270*log(tan(e + f*x)**2 + 1)*a*b**2*c**2*d + 90*log( 
tan(e + f*x)**2 + 1)*a*b**2*d**3 - 30*log(tan(e + f*x)**2 + 1)*b**3*c**3 + 
 90*log(tan(e + f*x)**2 + 1)*b**3*c*d**2 + 12*tan(e + f*x)**5*b**3*d**3 + 
45*tan(e + f*x)**4*a*b**2*d**3 + 45*tan(e + f*x)**4*b**3*c*d**2 + 60*tan(e 
 + f*x)**3*a**2*b*d**3 + 180*tan(e + f*x)**3*a*b**2*c*d**2 + 60*tan(e + f* 
x)**3*b**3*c**2*d - 20*tan(e + f*x)**3*b**3*d**3 + 30*tan(e + f*x)**2*a**3 
*d**3 + 270*tan(e + f*x)**2*a**2*b*c*d**2 + 270*tan(e + f*x)**2*a*b**2*c** 
2*d - 90*tan(e + f*x)**2*a*b**2*d**3 + 30*tan(e + f*x)**2*b**3*c**3 - 90*t 
an(e + f*x)**2*b**3*c*d**2 + 180*tan(e + f*x)*a**3*c*d**2 + 540*tan(e + f* 
x)*a**2*b*c**2*d - 180*tan(e + f*x)*a**2*b*d**3 + 180*tan(e + f*x)*a*b**2* 
c**3 - 540*tan(e + f*x)*a*b**2*c*d**2 - 180*tan(e + f*x)*b**3*c**2*d + 60* 
tan(e + f*x)*b**3*d**3 + 60*a**3*c**3*f*x - 180*a**3*c*d**2*f*x - 540*a**2 
*b*c**2*d*f*x + 180*a**2*b*d**3*f*x - 180*a*b**2*c**3*f*x + 540*a*b**2*c*d 
**2*f*x + 180*b**3*c**2*d*f*x - 60*b**3*d**3*f*x)/(60*f)