\(\int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx\) [446]

Optimal result
Mathematica [C] (verified)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [A] (verification not implemented)
Sympy [A] (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 = 21, antiderivative size = 128 \[ \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx=-\left (\left (a^4-6 a^2 b^2+b^4\right ) x\right )+\frac {4 a b \left (a^2-b^2\right ) \log (\cos (c+d x))}{d}-\frac {b^2 \left (3 a^2-b^2\right ) \tan (c+d x)}{d}-\frac {a b (a+b \tan (c+d x))^2}{d}-\frac {b (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^5}{5 b d} \] Output:

-(a^4-6*a^2*b^2+b^4)*x+4*a*b*(a^2-b^2)*ln(cos(d*x+c))/d-b^2*(3*a^2-b^2)*ta 
n(d*x+c)/d-a*b*(a+b*tan(d*x+c))^2/d-1/3*b*(a+b*tan(d*x+c))^3/d+1/5*(a+b*ta 
n(d*x+c))^5/b/d
 

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.49 (sec) , antiderivative size = 122, normalized size of antiderivative = 0.95 \[ \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx=\frac {15 i (a+i b)^4 \log (i-\tan (c+d x))-15 i (a-i b)^4 \log (i+\tan (c+d x))+30 b^2 \left (-6 a^2+b^2\right ) \tan (c+d x)-60 a b^3 \tan ^2(c+d x)-10 b^4 \tan ^3(c+d x)+\frac {6 (a+b \tan (c+d x))^5}{b}}{30 d} \] Input:

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

Output:

((15*I)*(a + I*b)^4*Log[I - Tan[c + d*x]] - (15*I)*(a - I*b)^4*Log[I + Tan 
[c + d*x]] + 30*b^2*(-6*a^2 + b^2)*Tan[c + d*x] - 60*a*b^3*Tan[c + d*x]^2 
- 10*b^4*Tan[c + d*x]^3 + (6*(a + b*Tan[c + d*x])^5)/b)/(30*d)
 

Rubi [A] (verified)

Time = 0.66 (sec) , antiderivative size = 128, normalized size of antiderivative = 1.00, number of steps used = 11, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.524, Rules used = {3042, 4026, 25, 3042, 3963, 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 \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \tan (c+d x)^2 (a+b \tan (c+d x))^4dx\)

\(\Big \downarrow \) 4026

\(\displaystyle \int -(a+b \tan (c+d x))^4dx+\frac {(a+b \tan (c+d x))^5}{5 b d}\)

\(\Big \downarrow \) 25

\(\displaystyle \frac {(a+b \tan (c+d x))^5}{5 b d}-\int (a+b \tan (c+d x))^4dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \frac {(a+b \tan (c+d x))^5}{5 b d}-\int (a+b \tan (c+d x))^4dx\)

\(\Big \downarrow \) 3963

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4011

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4008

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], 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 3963
Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((a + 
b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] + Int[(a^2 - b^2 + 2*a*b*Tan[c + d 
*x])*(a + b*Tan[c + d*x])^(n - 2), x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 
+ b^2, 0] && GtQ[n, 1]
 

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] (verified)

Time = 0.49 (sec) , antiderivative size = 158, normalized size of antiderivative = 1.23

method result size
norman \(\left (-a^{4}+6 b^{2} a^{2}-b^{4}\right ) x +\frac {\left (a^{4}-6 b^{2} a^{2}+b^{4}\right ) \tan \left (d x +c \right )}{d}+\frac {a \,b^{3} \tan \left (d x +c \right )^{4}}{d}+\frac {b^{4} \tan \left (d x +c \right )^{5}}{5 d}+\frac {b^{2} \left (6 a^{2}-b^{2}\right ) \tan \left (d x +c \right )^{3}}{3 d}+\frac {2 a b \left (a^{2}-b^{2}\right ) \tan \left (d x +c \right )^{2}}{d}-\frac {2 a b \left (a^{2}-b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{d}\) \(158\)
derivativedivides \(\frac {\frac {b^{4} \tan \left (d x +c \right )^{5}}{5}+a \,b^{3} \tan \left (d x +c \right )^{4}+2 b^{2} a^{2} \tan \left (d x +c \right )^{3}-\frac {b^{4} \tan \left (d x +c \right )^{3}}{3}+2 a^{3} b \tan \left (d x +c \right )^{2}-2 a \,b^{3} \tan \left (d x +c \right )^{2}+a^{4} \tan \left (d x +c \right )-6 b^{2} a^{2} \tan \left (d x +c \right )+b^{4} \tan \left (d x +c \right )+\frac {\left (-4 a^{3} b +4 a \,b^{3}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-a^{4}+6 b^{2} a^{2}-b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(176\)
default \(\frac {\frac {b^{4} \tan \left (d x +c \right )^{5}}{5}+a \,b^{3} \tan \left (d x +c \right )^{4}+2 b^{2} a^{2} \tan \left (d x +c \right )^{3}-\frac {b^{4} \tan \left (d x +c \right )^{3}}{3}+2 a^{3} b \tan \left (d x +c \right )^{2}-2 a \,b^{3} \tan \left (d x +c \right )^{2}+a^{4} \tan \left (d x +c \right )-6 b^{2} a^{2} \tan \left (d x +c \right )+b^{4} \tan \left (d x +c \right )+\frac {\left (-4 a^{3} b +4 a \,b^{3}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (-a^{4}+6 b^{2} a^{2}-b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) \(176\)
parallelrisch \(-\frac {-3 b^{4} \tan \left (d x +c \right )^{5}-15 a \,b^{3} \tan \left (d x +c \right )^{4}-30 b^{2} a^{2} \tan \left (d x +c \right )^{3}+5 b^{4} \tan \left (d x +c \right )^{3}+15 a^{4} x d -90 a^{2} b^{2} d x +15 b^{4} d x -30 a^{3} b \tan \left (d x +c \right )^{2}+30 a \,b^{3} \tan \left (d x +c \right )^{2}+30 \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a^{3} b -30 \ln \left (1+\tan \left (d x +c \right )^{2}\right ) a \,b^{3}-15 a^{4} \tan \left (d x +c \right )+90 b^{2} a^{2} \tan \left (d x +c \right )-15 b^{4} \tan \left (d x +c \right )}{15 d}\) \(185\)
parts \(\frac {a^{4} \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {b^{4} \left (\frac {\tan \left (d x +c \right )^{5}}{5}-\frac {\tan \left (d x +c \right )^{3}}{3}+\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {4 a \,b^{3} \left (\frac {\tan \left (d x +c \right )^{4}}{4}-\frac {\tan \left (d x +c \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}\right )}{d}+\frac {2 a^{3} b \tan \left (d x +c \right )^{2}}{d}-\frac {2 a^{3} b \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{d}+\frac {6 b^{2} a^{2} \left (\frac {\tan \left (d x +c \right )^{3}}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(185\)
risch \(-4 i a^{3} b x +4 i a \,b^{3} x -a^{4} x +6 a^{2} b^{2} x -b^{4} x -\frac {8 i a^{3} b c}{d}+\frac {8 i a \,b^{3} c}{d}+\frac {2 i \left (-180 i a^{3} b \,{\mathrm e}^{6 i \left (d x +c \right )}+240 i a \,b^{3} {\mathrm e}^{6 i \left (d x +c \right )}+15 a^{4} {\mathrm e}^{8 i \left (d x +c \right )}-180 a^{2} b^{2} {\mathrm e}^{8 i \left (d x +c \right )}+45 b^{4} {\mathrm e}^{8 i \left (d x +c \right )}+120 i a \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}-60 i a^{3} b \,{\mathrm e}^{2 i \left (d x +c \right )}+60 a^{4} {\mathrm e}^{6 i \left (d x +c \right )}-540 a^{2} b^{2} {\mathrm e}^{6 i \left (d x +c \right )}+90 b^{4} {\mathrm e}^{6 i \left (d x +c \right )}-180 i a^{3} b \,{\mathrm e}^{4 i \left (d x +c \right )}+240 i a \,b^{3} {\mathrm e}^{4 i \left (d x +c \right )}+90 a^{4} {\mathrm e}^{4 i \left (d x +c \right )}-660 a^{2} b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+140 b^{4} {\mathrm e}^{4 i \left (d x +c \right )}-60 i a^{3} b \,{\mathrm e}^{8 i \left (d x +c \right )}+120 i a \,b^{3} {\mathrm e}^{8 i \left (d x +c \right )}+60 a^{4} {\mathrm e}^{2 i \left (d x +c \right )}-420 a^{2} b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+70 b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+15 a^{4}-120 b^{2} a^{2}+23 b^{4}\right )}{15 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{5}}+\frac {4 a^{3} b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}-\frac {4 a \,b^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(449\)

Input:

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

Output:

(-a^4+6*a^2*b^2-b^4)*x+(a^4-6*a^2*b^2+b^4)/d*tan(d*x+c)+a*b^3/d*tan(d*x+c) 
^4+1/5*b^4/d*tan(d*x+c)^5+1/3*b^2*(6*a^2-b^2)/d*tan(d*x+c)^3+2*a*b*(a^2-b^ 
2)/d*tan(d*x+c)^2-2*a*b*(a^2-b^2)/d*ln(1+tan(d*x+c)^2)
 

Fricas [A] (verification not implemented)

Time = 0.09 (sec) , antiderivative size = 148, normalized size of antiderivative = 1.16 \[ \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx=\frac {3 \, b^{4} \tan \left (d x + c\right )^{5} + 15 \, a b^{3} \tan \left (d x + c\right )^{4} + 5 \, {\left (6 \, a^{2} b^{2} - b^{4}\right )} \tan \left (d x + c\right )^{3} - 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} d x + 30 \, {\left (a^{3} b - a b^{3}\right )} \tan \left (d x + c\right )^{2} + 30 \, {\left (a^{3} b - a b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \tan \left (d x + c\right )}{15 \, d} \] Input:

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

Output:

1/15*(3*b^4*tan(d*x + c)^5 + 15*a*b^3*tan(d*x + c)^4 + 5*(6*a^2*b^2 - b^4) 
*tan(d*x + c)^3 - 15*(a^4 - 6*a^2*b^2 + b^4)*d*x + 30*(a^3*b - a*b^3)*tan( 
d*x + c)^2 + 30*(a^3*b - a*b^3)*log(1/(tan(d*x + c)^2 + 1)) + 15*(a^4 - 6* 
a^2*b^2 + b^4)*tan(d*x + c))/d
 

Sympy [A] (verification not implemented)

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

integrate(tan(d*x+c)**2*(a+b*tan(d*x+c))**4,x)
 

Output:

Piecewise((-a**4*x + a**4*tan(c + d*x)/d - 2*a**3*b*log(tan(c + d*x)**2 + 
1)/d + 2*a**3*b*tan(c + d*x)**2/d + 6*a**2*b**2*x + 2*a**2*b**2*tan(c + d* 
x)**3/d - 6*a**2*b**2*tan(c + d*x)/d + 2*a*b**3*log(tan(c + d*x)**2 + 1)/d 
 + a*b**3*tan(c + d*x)**4/d - 2*a*b**3*tan(c + d*x)**2/d - b**4*x + b**4*t 
an(c + d*x)**5/(5*d) - b**4*tan(c + d*x)**3/(3*d) + b**4*tan(c + d*x)/d, N 
e(d, 0)), (x*(a + b*tan(c))**4*tan(c)**2, True))
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 149, normalized size of antiderivative = 1.16 \[ \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx=\frac {3 \, b^{4} \tan \left (d x + c\right )^{5} + 15 \, a b^{3} \tan \left (d x + c\right )^{4} + 5 \, {\left (6 \, a^{2} b^{2} - b^{4}\right )} \tan \left (d x + c\right )^{3} + 30 \, {\left (a^{3} b - a b^{3}\right )} \tan \left (d x + c\right )^{2} - 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} {\left (d x + c\right )} - 30 \, {\left (a^{3} b - a b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \tan \left (d x + c\right )}{15 \, d} \] Input:

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

Output:

1/15*(3*b^4*tan(d*x + c)^5 + 15*a*b^3*tan(d*x + c)^4 + 5*(6*a^2*b^2 - b^4) 
*tan(d*x + c)^3 + 30*(a^3*b - a*b^3)*tan(d*x + c)^2 - 15*(a^4 - 6*a^2*b^2 
+ b^4)*(d*x + c) - 30*(a^3*b - a*b^3)*log(tan(d*x + c)^2 + 1) + 15*(a^4 - 
6*a^2*b^2 + b^4)*tan(d*x + c))/d
 

Giac [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 207, normalized size of antiderivative = 1.62 \[ \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx=-\frac {{\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} {\left (d x + c\right )}}{d} - \frac {2 \, {\left (a^{3} b - a b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{d} + \frac {3 \, b^{4} d^{4} \tan \left (d x + c\right )^{5} + 15 \, a b^{3} d^{4} \tan \left (d x + c\right )^{4} + 30 \, a^{2} b^{2} d^{4} \tan \left (d x + c\right )^{3} - 5 \, b^{4} d^{4} \tan \left (d x + c\right )^{3} + 30 \, a^{3} b d^{4} \tan \left (d x + c\right )^{2} - 30 \, a b^{3} d^{4} \tan \left (d x + c\right )^{2} + 15 \, a^{4} d^{4} \tan \left (d x + c\right ) - 90 \, a^{2} b^{2} d^{4} \tan \left (d x + c\right ) + 15 \, b^{4} d^{4} \tan \left (d x + c\right )}{15 \, d^{5}} \] Input:

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

Output:

-(a^4 - 6*a^2*b^2 + b^4)*(d*x + c)/d - 2*(a^3*b - a*b^3)*log(tan(d*x + c)^ 
2 + 1)/d + 1/15*(3*b^4*d^4*tan(d*x + c)^5 + 15*a*b^3*d^4*tan(d*x + c)^4 + 
30*a^2*b^2*d^4*tan(d*x + c)^3 - 5*b^4*d^4*tan(d*x + c)^3 + 30*a^3*b*d^4*ta 
n(d*x + c)^2 - 30*a*b^3*d^4*tan(d*x + c)^2 + 15*a^4*d^4*tan(d*x + c) - 90* 
a^2*b^2*d^4*tan(d*x + c) + 15*b^4*d^4*tan(d*x + c))/d^5
 

Mupad [B] (verification not implemented)

Time = 1.09 (sec) , antiderivative size = 221, normalized size of antiderivative = 1.73 \[ \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx=\frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (2\,a\,b^3-2\,a^3\,b\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {b^4}{3}-2\,a^2\,b^2\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (2\,a\,b^3-2\,a^3\,b\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^4-6\,a^2\,b^2+b^4\right )}{d}+\frac {b^4\,{\mathrm {tan}\left (c+d\,x\right )}^5}{5\,d}-\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-a^2+2\,a\,b+b^2\right )\,\left (a^2+2\,a\,b-b^2\right )}{a^4-6\,a^2\,b^2+b^4}\right )\,\left (-a^2+2\,a\,b+b^2\right )\,\left (a^2+2\,a\,b-b^2\right )}{d}+\frac {a\,b^3\,{\mathrm {tan}\left (c+d\,x\right )}^4}{d} \] Input:

int(tan(c + d*x)^2*(a + b*tan(c + d*x))^4,x)
 

Output:

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

Reduce [B] (verification not implemented)

Time = 0.25 (sec) , antiderivative size = 184, normalized size of antiderivative = 1.44 \[ \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx=\frac {-30 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a^{3} b +30 \,\mathrm {log}\left (\tan \left (d x +c \right )^{2}+1\right ) a \,b^{3}+3 \tan \left (d x +c \right )^{5} b^{4}+15 \tan \left (d x +c \right )^{4} a \,b^{3}+30 \tan \left (d x +c \right )^{3} a^{2} b^{2}-5 \tan \left (d x +c \right )^{3} b^{4}+30 \tan \left (d x +c \right )^{2} a^{3} b -30 \tan \left (d x +c \right )^{2} a \,b^{3}+15 \tan \left (d x +c \right ) a^{4}-90 \tan \left (d x +c \right ) a^{2} b^{2}+15 \tan \left (d x +c \right ) b^{4}-15 a^{4} d x +90 a^{2} b^{2} d x -15 b^{4} d x}{15 d} \] Input:

int(tan(d*x+c)^2*(a+b*tan(d*x+c))^4,x)
 

Output:

( - 30*log(tan(c + d*x)**2 + 1)*a**3*b + 30*log(tan(c + d*x)**2 + 1)*a*b** 
3 + 3*tan(c + d*x)**5*b**4 + 15*tan(c + d*x)**4*a*b**3 + 30*tan(c + d*x)** 
3*a**2*b**2 - 5*tan(c + d*x)**3*b**4 + 30*tan(c + d*x)**2*a**3*b - 30*tan( 
c + d*x)**2*a*b**3 + 15*tan(c + d*x)*a**4 - 90*tan(c + d*x)*a**2*b**2 + 15 
*tan(c + d*x)*b**4 - 15*a**4*d*x + 90*a**2*b**2*d*x - 15*b**4*d*x)/(15*d)