\(\int \tan ^6(e+f x) (a+b \tan ^2(e+f x))^2 \, dx\) [204]

Optimal result
Mathematica [B] (verified)
Rubi [A] (verified)
Maple [A] (verified)
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 = 23, antiderivative size = 113 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=-(a-b)^2 x+\frac {(a-b)^2 \tan (e+f x)}{f}-\frac {(a-b)^2 \tan ^3(e+f x)}{3 f}+\frac {(a-b)^2 \tan ^5(e+f x)}{5 f}+\frac {(2 a-b) b \tan ^7(e+f x)}{7 f}+\frac {b^2 \tan ^9(e+f x)}{9 f} \] Output:

-(a-b)^2*x+(a-b)^2*tan(f*x+e)/f-1/3*(a-b)^2*tan(f*x+e)^3/f+1/5*(a-b)^2*tan 
(f*x+e)^5/f+1/7*(2*a-b)*b*tan(f*x+e)^7/f+1/9*b^2*tan(f*x+e)^9/f
 

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(243\) vs. \(2(113)=226\).

Time = 0.06 (sec) , antiderivative size = 243, normalized size of antiderivative = 2.15 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=-\frac {a^2 \arctan (\tan (e+f x))}{f}+\frac {2 a b \arctan (\tan (e+f x))}{f}-\frac {b^2 \arctan (\tan (e+f x))}{f}+\frac {a^2 \tan (e+f x)}{f}-\frac {2 a b \tan (e+f x)}{f}+\frac {b^2 \tan (e+f x)}{f}-\frac {a^2 \tan ^3(e+f x)}{3 f}+\frac {2 a b \tan ^3(e+f x)}{3 f}-\frac {b^2 \tan ^3(e+f x)}{3 f}+\frac {a^2 \tan ^5(e+f x)}{5 f}-\frac {2 a b \tan ^5(e+f x)}{5 f}+\frac {b^2 \tan ^5(e+f x)}{5 f}+\frac {2 a b \tan ^7(e+f x)}{7 f}-\frac {b^2 \tan ^7(e+f x)}{7 f}+\frac {b^2 \tan ^9(e+f x)}{9 f} \] Input:

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

Output:

-((a^2*ArcTan[Tan[e + f*x]])/f) + (2*a*b*ArcTan[Tan[e + f*x]])/f - (b^2*Ar 
cTan[Tan[e + f*x]])/f + (a^2*Tan[e + f*x])/f - (2*a*b*Tan[e + f*x])/f + (b 
^2*Tan[e + f*x])/f - (a^2*Tan[e + f*x]^3)/(3*f) + (2*a*b*Tan[e + f*x]^3)/( 
3*f) - (b^2*Tan[e + f*x]^3)/(3*f) + (a^2*Tan[e + f*x]^5)/(5*f) - (2*a*b*Ta 
n[e + f*x]^5)/(5*f) + (b^2*Tan[e + f*x]^5)/(5*f) + (2*a*b*Tan[e + f*x]^7)/ 
(7*f) - (b^2*Tan[e + f*x]^7)/(7*f) + (b^2*Tan[e + f*x]^9)/(9*f)
 

Rubi [A] (verified)

Time = 0.51 (sec) , antiderivative size = 108, normalized size of antiderivative = 0.96, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {3042, 4153, 364, 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 \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4153

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

\(\Big \downarrow \) 364

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

\(\Big \downarrow \) 2009

\(\displaystyle \frac {-(a-b)^2 \arctan (\tan (e+f x))+\frac {1}{7} b (2 a-b) \tan ^7(e+f x)+\frac {1}{5} (a-b)^2 \tan ^5(e+f x)-\frac {1}{3} (a-b)^2 \tan ^3(e+f x)+(a-b)^2 \tan (e+f x)+\frac {1}{9} b^2 \tan ^9(e+f x)}{f}\)

Input:

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

Output:

(-((a - b)^2*ArcTan[Tan[e + f*x]]) + (a - b)^2*Tan[e + f*x] - ((a - b)^2*T 
an[e + f*x]^3)/3 + ((a - b)^2*Tan[e + f*x]^5)/5 + ((2*a - b)*b*Tan[e + f*x 
]^7)/7 + (b^2*Tan[e + f*x]^9)/9)/f
 

Defintions of rubi rules used

rule 364
Int[(((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_))/((c_) + (d_.)*(x_)^2), 
x_Symbol] :> Int[ExpandIntegrand[(e*x)^m*((a + b*x^2)^p/(c + d*x^2)), x], x 
] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[p, 0] && (In 
tegerQ[m] || IGtQ[2*(m + 1), 0] ||  !RationalQ[m])
 

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

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 4153
Int[((d_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*((c_.)*tan[(e_.) + 
(f_.)*(x_)])^(n_))^(p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], 
 x]}, Simp[c*(ff/f)   Subst[Int[(d*ff*(x/c))^m*((a + b*(ff*x)^n)^p/(c^2 + f 
f^2*x^2)), x], x, c*(Tan[e + f*x]/ff)], x]] /; FreeQ[{a, b, c, d, e, f, m, 
n, p}, x] && (IGtQ[p, 0] || EqQ[n, 2] || EqQ[n, 4] || (IntegerQ[p] && Ratio 
nalQ[n]))
 
Maple [A] (verified)

Time = 0.77 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.11

method result size
norman \(\left (-a^{2}+2 a b -b^{2}\right ) x +\frac {\left (a^{2}-2 a b +b^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {b^{2} \tan \left (f x +e \right )^{9}}{9 f}-\frac {\left (a^{2}-2 a b +b^{2}\right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {\left (a^{2}-2 a b +b^{2}\right ) \tan \left (f x +e \right )^{5}}{5 f}+\frac {\left (2 a -b \right ) b \tan \left (f x +e \right )^{7}}{7 f}\) \(125\)
parts \(\frac {a^{2} \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}+\frac {b^{2} \left (\frac {\tan \left (f x +e \right )^{9}}{9}-\frac {\tan \left (f x +e \right )^{7}}{7}+\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}+\frac {2 a b \left (\frac {\tan \left (f x +e \right )^{7}}{7}-\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}\) \(161\)
derivativedivides \(\frac {\frac {b^{2} \tan \left (f x +e \right )^{9}}{9}+\frac {2 a b \tan \left (f x +e \right )^{7}}{7}-\frac {b^{2} \tan \left (f x +e \right )^{7}}{7}+\frac {a^{2} \tan \left (f x +e \right )^{5}}{5}-\frac {2 a b \tan \left (f x +e \right )^{5}}{5}+\frac {b^{2} \tan \left (f x +e \right )^{5}}{5}-\frac {a^{2} \tan \left (f x +e \right )^{3}}{3}+\frac {2 a b \tan \left (f x +e \right )^{3}}{3}-\frac {\tan \left (f x +e \right )^{3} b^{2}}{3}+a^{2} \tan \left (f x +e \right )-2 \tan \left (f x +e \right ) a b +\tan \left (f x +e \right ) b^{2}+\left (-a^{2}+2 a b -b^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(173\)
default \(\frac {\frac {b^{2} \tan \left (f x +e \right )^{9}}{9}+\frac {2 a b \tan \left (f x +e \right )^{7}}{7}-\frac {b^{2} \tan \left (f x +e \right )^{7}}{7}+\frac {a^{2} \tan \left (f x +e \right )^{5}}{5}-\frac {2 a b \tan \left (f x +e \right )^{5}}{5}+\frac {b^{2} \tan \left (f x +e \right )^{5}}{5}-\frac {a^{2} \tan \left (f x +e \right )^{3}}{3}+\frac {2 a b \tan \left (f x +e \right )^{3}}{3}-\frac {\tan \left (f x +e \right )^{3} b^{2}}{3}+a^{2} \tan \left (f x +e \right )-2 \tan \left (f x +e \right ) a b +\tan \left (f x +e \right ) b^{2}+\left (-a^{2}+2 a b -b^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(173\)
parallelrisch \(-\frac {-35 b^{2} \tan \left (f x +e \right )^{9}-90 a b \tan \left (f x +e \right )^{7}+45 b^{2} \tan \left (f x +e \right )^{7}-63 a^{2} \tan \left (f x +e \right )^{5}+126 a b \tan \left (f x +e \right )^{5}-63 b^{2} \tan \left (f x +e \right )^{5}+105 a^{2} \tan \left (f x +e \right )^{3}-210 a b \tan \left (f x +e \right )^{3}+105 \tan \left (f x +e \right )^{3} b^{2}+315 a^{2} f x -630 a b f x +315 b^{2} f x -315 a^{2} \tan \left (f x +e \right )+630 \tan \left (f x +e \right ) a b -315 \tan \left (f x +e \right ) b^{2}}{315 f}\) \(173\)
risch \(-x \,a^{2}+2 x a b -x \,b^{2}+\frac {2 i \left (483 a^{2}+563 b^{2}-1056 a b +945 a^{2} {\mathrm e}^{16 i \left (f x +e \right )}+21000 b^{2} {\mathrm e}^{12 i \left (f x +e \right )}+11718 a^{2} {\mathrm e}^{4 i \left (f x +e \right )}+13968 b^{2} {\mathrm e}^{4 i \left (f x +e \right )}+3492 b^{2} {\mathrm e}^{2 i \left (f x +e \right )}+16170 a^{2} {\mathrm e}^{12 i \left (f x +e \right )}+28350 a^{2} {\mathrm e}^{10 i \left (f x +e \right )}+31500 b^{2} {\mathrm e}^{10 i \left (f x +e \right )}+32508 a^{2} {\mathrm e}^{8 i \left (f x +e \right )}+39438 b^{2} {\mathrm e}^{8 i \left (f x +e \right )}+24402 a^{2} {\mathrm e}^{6 i \left (f x +e \right )}+26292 b^{2} {\mathrm e}^{6 i \left (f x +e \right )}+5670 a^{2} {\mathrm e}^{14 i \left (f x +e \right )}+6300 b^{2} {\mathrm e}^{14 i \left (f x +e \right )}+1575 b^{2} {\mathrm e}^{16 i \left (f x +e \right )}+3402 a^{2} {\mathrm e}^{2 i \left (f x +e \right )}-12600 a b \,{\mathrm e}^{14 i \left (f x +e \right )}-25416 a b \,{\mathrm e}^{4 i \left (f x +e \right )}-2520 a b \,{\mathrm e}^{16 i \left (f x +e \right )}-36120 a b \,{\mathrm e}^{12 i \left (f x +e \right )}-63000 a b \,{\mathrm e}^{10 i \left (f x +e \right )}-70056 a b \,{\mathrm e}^{8 i \left (f x +e \right )}-52584 a b \,{\mathrm e}^{6 i \left (f x +e \right )}-6984 a b \,{\mathrm e}^{2 i \left (f x +e \right )}\right )}{315 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{9}}\) \(381\)

Input:

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

Output:

(-a^2+2*a*b-b^2)*x+(a^2-2*a*b+b^2)/f*tan(f*x+e)+1/9*b^2*tan(f*x+e)^9/f-1/3 
*(a^2-2*a*b+b^2)/f*tan(f*x+e)^3+1/5*(a^2-2*a*b+b^2)/f*tan(f*x+e)^5+1/7*(2* 
a-b)*b*tan(f*x+e)^7/f
 

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 115, normalized size of antiderivative = 1.02 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\frac {35 \, b^{2} \tan \left (f x + e\right )^{9} + 45 \, {\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )^{7} + 63 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{5} - 105 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{3} - 315 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} f x + 315 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )}{315 \, f} \] Input:

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

Output:

1/315*(35*b^2*tan(f*x + e)^9 + 45*(2*a*b - b^2)*tan(f*x + e)^7 + 63*(a^2 - 
 2*a*b + b^2)*tan(f*x + e)^5 - 105*(a^2 - 2*a*b + b^2)*tan(f*x + e)^3 - 31 
5*(a^2 - 2*a*b + b^2)*f*x + 315*(a^2 - 2*a*b + b^2)*tan(f*x + e))/f
 

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 212 vs. \(2 (88) = 176\).

Time = 0.29 (sec) , antiderivative size = 212, normalized size of antiderivative = 1.88 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\begin {cases} - a^{2} x + \frac {a^{2} \tan ^{5}{\left (e + f x \right )}}{5 f} - \frac {a^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} + \frac {a^{2} \tan {\left (e + f x \right )}}{f} + 2 a b x + \frac {2 a b \tan ^{7}{\left (e + f x \right )}}{7 f} - \frac {2 a b \tan ^{5}{\left (e + f x \right )}}{5 f} + \frac {2 a b \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {2 a b \tan {\left (e + f x \right )}}{f} - b^{2} x + \frac {b^{2} \tan ^{9}{\left (e + f x \right )}}{9 f} - \frac {b^{2} \tan ^{7}{\left (e + f x \right )}}{7 f} + \frac {b^{2} \tan ^{5}{\left (e + f x \right )}}{5 f} - \frac {b^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} + \frac {b^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan ^{2}{\left (e \right )}\right )^{2} \tan ^{6}{\left (e \right )} & \text {otherwise} \end {cases} \] Input:

integrate(tan(f*x+e)**6*(a+b*tan(f*x+e)**2)**2,x)
 

Output:

Piecewise((-a**2*x + a**2*tan(e + f*x)**5/(5*f) - a**2*tan(e + f*x)**3/(3* 
f) + a**2*tan(e + f*x)/f + 2*a*b*x + 2*a*b*tan(e + f*x)**7/(7*f) - 2*a*b*t 
an(e + f*x)**5/(5*f) + 2*a*b*tan(e + f*x)**3/(3*f) - 2*a*b*tan(e + f*x)/f 
- b**2*x + b**2*tan(e + f*x)**9/(9*f) - b**2*tan(e + f*x)**7/(7*f) + b**2* 
tan(e + f*x)**5/(5*f) - b**2*tan(e + f*x)**3/(3*f) + b**2*tan(e + f*x)/f, 
Ne(f, 0)), (x*(a + b*tan(e)**2)**2*tan(e)**6, True))
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 118, normalized size of antiderivative = 1.04 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\frac {35 \, b^{2} \tan \left (f x + e\right )^{9} + 45 \, {\left (2 \, a b - b^{2}\right )} \tan \left (f x + e\right )^{7} + 63 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{5} - 105 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{3} - 315 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} {\left (f x + e\right )} + 315 \, {\left (a^{2} - 2 \, a b + b^{2}\right )} \tan \left (f x + e\right )}{315 \, f} \] Input:

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

Output:

1/315*(35*b^2*tan(f*x + e)^9 + 45*(2*a*b - b^2)*tan(f*x + e)^7 + 63*(a^2 - 
 2*a*b + b^2)*tan(f*x + e)^5 - 105*(a^2 - 2*a*b + b^2)*tan(f*x + e)^3 - 31 
5*(a^2 - 2*a*b + b^2)*(f*x + e) + 315*(a^2 - 2*a*b + b^2)*tan(f*x + e))/f
 

Giac [A] (verification not implemented)

Time = 0.62 (sec) , antiderivative size = 210, normalized size of antiderivative = 1.86 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=-\frac {{\left (a^{2} - 2 \, a b + b^{2}\right )} {\left (f x + e\right )}}{f} + \frac {35 \, b^{2} f^{8} \tan \left (f x + e\right )^{9} + 90 \, a b f^{8} \tan \left (f x + e\right )^{7} - 45 \, b^{2} f^{8} \tan \left (f x + e\right )^{7} + 63 \, a^{2} f^{8} \tan \left (f x + e\right )^{5} - 126 \, a b f^{8} \tan \left (f x + e\right )^{5} + 63 \, b^{2} f^{8} \tan \left (f x + e\right )^{5} - 105 \, a^{2} f^{8} \tan \left (f x + e\right )^{3} + 210 \, a b f^{8} \tan \left (f x + e\right )^{3} - 105 \, b^{2} f^{8} \tan \left (f x + e\right )^{3} + 315 \, a^{2} f^{8} \tan \left (f x + e\right ) - 630 \, a b f^{8} \tan \left (f x + e\right ) + 315 \, b^{2} f^{8} \tan \left (f x + e\right )}{315 \, f^{9}} \] Input:

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

Output:

-(a^2 - 2*a*b + b^2)*(f*x + e)/f + 1/315*(35*b^2*f^8*tan(f*x + e)^9 + 90*a 
*b*f^8*tan(f*x + e)^7 - 45*b^2*f^8*tan(f*x + e)^7 + 63*a^2*f^8*tan(f*x + e 
)^5 - 126*a*b*f^8*tan(f*x + e)^5 + 63*b^2*f^8*tan(f*x + e)^5 - 105*a^2*f^8 
*tan(f*x + e)^3 + 210*a*b*f^8*tan(f*x + e)^3 - 105*b^2*f^8*tan(f*x + e)^3 
+ 315*a^2*f^8*tan(f*x + e) - 630*a*b*f^8*tan(f*x + e) + 315*b^2*f^8*tan(f* 
x + e))/f^9
 

Mupad [B] (verification not implemented)

Time = 7.51 (sec) , antiderivative size = 155, normalized size of antiderivative = 1.37 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\frac {{\mathrm {tan}\left (e+f\,x\right )}^7\,\left (\frac {2\,a\,b}{7}-\frac {b^2}{7}\right )}{f}-\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (e+f\,x\right )\,{\left (a-b\right )}^2}{a^2-2\,a\,b+b^2}\right )\,{\left (a-b\right )}^2}{f}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (a^2-2\,a\,b+b^2\right )}{f}+\frac {b^2\,{\mathrm {tan}\left (e+f\,x\right )}^9}{9\,f}-\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (\frac {a^2}{3}-\frac {2\,a\,b}{3}+\frac {b^2}{3}\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^5\,\left (\frac {a^2}{5}-\frac {2\,a\,b}{5}+\frac {b^2}{5}\right )}{f} \] Input:

int(tan(e + f*x)^6*(a + b*tan(e + f*x)^2)^2,x)
 

Output:

(tan(e + f*x)^7*((2*a*b)/7 - b^2/7))/f - (atan((tan(e + f*x)*(a - b)^2)/(a 
^2 - 2*a*b + b^2))*(a - b)^2)/f + (tan(e + f*x)*(a^2 - 2*a*b + b^2))/f + ( 
b^2*tan(e + f*x)^9)/(9*f) - (tan(e + f*x)^3*(a^2/3 - (2*a*b)/3 + b^2/3))/f 
 + (tan(e + f*x)^5*(a^2/5 - (2*a*b)/5 + b^2/5))/f
 

Reduce [B] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 172, normalized size of antiderivative = 1.52 \[ \int \tan ^6(e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx=\frac {35 \tan \left (f x +e \right )^{9} b^{2}+90 \tan \left (f x +e \right )^{7} a b -45 \tan \left (f x +e \right )^{7} b^{2}+63 \tan \left (f x +e \right )^{5} a^{2}-126 \tan \left (f x +e \right )^{5} a b +63 \tan \left (f x +e \right )^{5} b^{2}-105 \tan \left (f x +e \right )^{3} a^{2}+210 \tan \left (f x +e \right )^{3} a b -105 \tan \left (f x +e \right )^{3} b^{2}+315 \tan \left (f x +e \right ) a^{2}-630 \tan \left (f x +e \right ) a b +315 \tan \left (f x +e \right ) b^{2}-315 a^{2} f x +630 a b f x -315 b^{2} f x}{315 f} \] Input:

int(tan(f*x+e)^6*(a+b*tan(f*x+e)^2)^2,x)
 

Output:

(35*tan(e + f*x)**9*b**2 + 90*tan(e + f*x)**7*a*b - 45*tan(e + f*x)**7*b** 
2 + 63*tan(e + f*x)**5*a**2 - 126*tan(e + f*x)**5*a*b + 63*tan(e + f*x)**5 
*b**2 - 105*tan(e + f*x)**3*a**2 + 210*tan(e + f*x)**3*a*b - 105*tan(e + f 
*x)**3*b**2 + 315*tan(e + f*x)*a**2 - 630*tan(e + f*x)*a*b + 315*tan(e + f 
*x)*b**2 - 315*a**2*f*x + 630*a*b*f*x - 315*b**2*f*x)/(315*f)