\(\int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^3} \, dx\) [1223]

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

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

Mathematica [C] (verified)

Result contains complex when optimal does not.

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

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

Output:

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

Rubi [A] (verified)

Time = 1.83 (sec) , antiderivative size = 440, normalized size of antiderivative = 1.08, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.440, Rules used = {3042, 4048, 27, 3042, 4118, 3042, 4109, 3042, 3956, 4100, 16}

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 \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^3} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4048

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

\(\Big \downarrow \) 27

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4118

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4109

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

\(\Big \downarrow \) 4100

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

\(\Big \downarrow \) 16

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

Input:

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

Output:

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

Defintions of rubi rules used

rule 16
Int[(c_.)/((a_.) + (b_.)*(x_)), x_Symbol] :> Simp[c*(Log[RemoveContent[a + 
b*x, x]]/b), x] /; FreeQ[{a, b, c}, x]
 

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

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

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

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

rule 4100
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_) + (C_.)*tan[(e_.) + 
 (f_.)*(x_)]^2), x_Symbol] :> Simp[A/(b*f)   Subst[Int[(a + x)^m, x], x, b* 
Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, A, C, m}, x] && EqQ[A, C]
 

rule 4109
Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2 
)/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*A + b*B - a 
*C)*(x/(a^2 + b^2)), x] + (Simp[(A*b^2 - a*b*B + a^2*C)/(a^2 + b^2)   Int[( 
1 + Tan[e + f*x]^2)/(a + b*Tan[e + f*x]), x], x] - Simp[(A*b - a*B - b*C)/( 
a^2 + b^2)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, e, f, A, B, C}, x] & 
& NeQ[A*b^2 - a*b*B + a^2*C, 0] && NeQ[a^2 + b^2, 0] && NeQ[A*b - a*B - b*C 
, 0]
 

rule 4118
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_. 
)*(x_)])^(n_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f 
_.)*(x_)]^2), x_Symbol] :> Simp[(-(b*c - a*d))*(c^2*C - B*c*d + A*d^2)*((c 
+ d*Tan[e + f*x])^(n + 1)/(d^2*f*(n + 1)*(c^2 + d^2))), x] + Simp[1/(d*(c^2 
 + d^2))   Int[(c + d*Tan[e + f*x])^(n + 1)*Simp[a*d*(A*c - c*C + B*d) + b* 
(c^2*C - B*c*d + A*d^2) + d*(A*b*c + a*B*c - b*c*C - a*A*d + b*B*d + a*C*d) 
*Tan[e + f*x] + b*C*(c^2 + d^2)*Tan[e + f*x]^2, x], x], x] /; FreeQ[{a, b, 
c, d, e, f, A, B, C}, x] && NeQ[b*c - a*d, 0] && NeQ[c^2 + d^2, 0] && LtQ[n 
, -1]
 
Maple [A] (verified)

Time = 0.37 (sec) , antiderivative size = 553, normalized size of antiderivative = 1.36

method result size
derivativedivides \(\frac {\frac {\frac {\left (-3 a^{4} c^{2} d +a^{4} d^{3}+4 a^{3} c^{3} b -12 a^{3} b c \,d^{2}+18 a^{2} b^{2} c^{2} d -6 a^{2} b^{2} d^{3}-4 a \,c^{3} b^{3}+12 a \,b^{3} c \,d^{2}-3 b^{4} c^{2} d +b^{4} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{4} c^{3}-3 a^{4} c \,d^{2}+12 a^{3} b \,c^{2} d -4 a^{3} b \,d^{3}-6 a^{2} b^{2} c^{3}+18 a^{2} b^{2} c \,d^{2}-12 a \,b^{3} c^{2} d +4 a \,b^{3} d^{3}+b^{4} c^{3}-3 b^{4} c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3}}-\frac {a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,c^{3} b^{3} d +b^{4} c^{4}}{2 d^{3} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )^{2}}-\frac {2 a^{4} c \,d^{4}-4 a^{3} b \,c^{2} d^{3}+4 a^{3} b \,d^{5}-12 a^{2} b^{2} c \,d^{4}+4 a \,b^{3} c^{4} d +12 a \,b^{3} c^{2} d^{3}-2 b^{4} c^{5}-4 b^{4} c^{3} d^{2}}{d^{3} \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (3 a^{4} c^{2} d^{4}-a^{4} d^{6}-4 a^{3} b \,c^{3} d^{3}+12 a^{3} b \,d^{5} c -18 a^{2} b^{2} c^{2} d^{4}+6 a^{2} b^{2} d^{6}+4 a \,b^{3} c^{3} d^{3}-12 a \,b^{3} c \,d^{5}+b^{4} c^{6}+3 b^{4} c^{4} d^{2}+6 b^{4} c^{2} d^{4}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3} d^{3}}}{f}\) \(553\)
default \(\frac {\frac {\frac {\left (-3 a^{4} c^{2} d +a^{4} d^{3}+4 a^{3} c^{3} b -12 a^{3} b c \,d^{2}+18 a^{2} b^{2} c^{2} d -6 a^{2} b^{2} d^{3}-4 a \,c^{3} b^{3}+12 a \,b^{3} c \,d^{2}-3 b^{4} c^{2} d +b^{4} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{4} c^{3}-3 a^{4} c \,d^{2}+12 a^{3} b \,c^{2} d -4 a^{3} b \,d^{3}-6 a^{2} b^{2} c^{3}+18 a^{2} b^{2} c \,d^{2}-12 a \,b^{3} c^{2} d +4 a \,b^{3} d^{3}+b^{4} c^{3}-3 b^{4} c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3}}-\frac {a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,c^{3} b^{3} d +b^{4} c^{4}}{2 d^{3} \left (c^{2}+d^{2}\right ) \left (c +d \tan \left (f x +e \right )\right )^{2}}-\frac {2 a^{4} c \,d^{4}-4 a^{3} b \,c^{2} d^{3}+4 a^{3} b \,d^{5}-12 a^{2} b^{2} c \,d^{4}+4 a \,b^{3} c^{4} d +12 a \,b^{3} c^{2} d^{3}-2 b^{4} c^{5}-4 b^{4} c^{3} d^{2}}{d^{3} \left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}+\frac {\left (3 a^{4} c^{2} d^{4}-a^{4} d^{6}-4 a^{3} b \,c^{3} d^{3}+12 a^{3} b \,d^{5} c -18 a^{2} b^{2} c^{2} d^{4}+6 a^{2} b^{2} d^{6}+4 a \,b^{3} c^{3} d^{3}-12 a \,b^{3} c \,d^{5}+b^{4} c^{6}+3 b^{4} c^{4} d^{2}+6 b^{4} c^{2} d^{4}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3} d^{3}}}{f}\) \(553\)
norman \(\frac {\frac {\left (a^{4} c^{3}-3 a^{4} c \,d^{2}+12 a^{3} b \,c^{2} d -4 a^{3} b \,d^{3}-6 a^{2} b^{2} c^{3}+18 a^{2} b^{2} c \,d^{2}-12 a \,b^{3} c^{2} d +4 a \,b^{3} d^{3}+b^{4} c^{3}-3 b^{4} c \,d^{2}\right ) c^{2} x}{\left (c^{4}+2 c^{2} d^{2}+d^{4}\right ) \left (c^{2}+d^{2}\right )}+\frac {d^{2} \left (a^{4} c^{3}-3 a^{4} c \,d^{2}+12 a^{3} b \,c^{2} d -4 a^{3} b \,d^{3}-6 a^{2} b^{2} c^{3}+18 a^{2} b^{2} c \,d^{2}-12 a \,b^{3} c^{2} d +4 a \,b^{3} d^{3}+b^{4} c^{3}-3 b^{4} c \,d^{2}\right ) x \tan \left (f x +e \right )^{2}}{\left (c^{4}+2 c^{2} d^{2}+d^{4}\right ) \left (c^{2}+d^{2}\right )}-\frac {5 a^{4} c^{2} d^{4}+a^{4} d^{6}-12 a^{3} b \,c^{3} d^{3}+4 a^{3} b \,d^{5} c +6 a^{2} b^{2} c^{4} d^{2}-18 a^{2} b^{2} c^{2} d^{4}+4 a \,b^{3} c^{5} d +20 a \,b^{3} c^{3} d^{3}-3 b^{4} c^{6}-7 b^{4} c^{4} d^{2}}{2 f \,d^{3} \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}-\frac {2 \left (a^{4} c \,d^{4}-2 a^{3} b \,c^{2} d^{3}+2 a^{3} b \,d^{5}-6 a^{2} b^{2} c \,d^{4}+2 a \,b^{3} c^{4} d +6 a \,b^{3} c^{2} d^{3}-b^{4} c^{5}-2 b^{4} c^{3} d^{2}\right ) \tan \left (f x +e \right )}{f \,d^{2} \left (c^{4}+2 c^{2} d^{2}+d^{4}\right )}+\frac {2 d \left (a^{4} c^{3}-3 a^{4} c \,d^{2}+12 a^{3} b \,c^{2} d -4 a^{3} b \,d^{3}-6 a^{2} b^{2} c^{3}+18 a^{2} b^{2} c \,d^{2}-12 a \,b^{3} c^{2} d +4 a \,b^{3} d^{3}+b^{4} c^{3}-3 b^{4} c \,d^{2}\right ) c x \tan \left (f x +e \right )}{\left (c^{4}+2 c^{2} d^{2}+d^{4}\right ) \left (c^{2}+d^{2}\right )}}{\left (c +d \tan \left (f x +e \right )\right )^{2}}+\frac {\left (3 a^{4} c^{2} d^{4}-a^{4} d^{6}-4 a^{3} b \,c^{3} d^{3}+12 a^{3} b \,d^{5} c -18 a^{2} b^{2} c^{2} d^{4}+6 a^{2} b^{2} d^{6}+4 a \,b^{3} c^{3} d^{3}-12 a \,b^{3} c \,d^{5}+b^{4} c^{6}+3 b^{4} c^{4} d^{2}+6 b^{4} c^{2} d^{4}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{6}+3 c^{4} d^{2}+3 c^{2} d^{4}+d^{6}\right ) d^{3} f}-\frac {\left (3 a^{4} c^{2} d -a^{4} d^{3}-4 a^{3} c^{3} b +12 a^{3} b c \,d^{2}-18 a^{2} b^{2} c^{2} d +6 a^{2} b^{2} d^{3}+4 a \,c^{3} b^{3}-12 a \,b^{3} c \,d^{2}+3 b^{4} c^{2} d -b^{4} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \left (c^{6}+3 c^{4} d^{2}+3 c^{2} d^{4}+d^{6}\right )}\) \(952\)
risch \(\text {Expression too large to display}\) \(2372\)
parallelrisch \(\text {Expression too large to display}\) \(2668\)

Input:

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

Output:

1/f*(1/(c^2+d^2)^3*(1/2*(-3*a^4*c^2*d+a^4*d^3+4*a^3*b*c^3-12*a^3*b*c*d^2+1 
8*a^2*b^2*c^2*d-6*a^2*b^2*d^3-4*a*b^3*c^3+12*a*b^3*c*d^2-3*b^4*c^2*d+b^4*d 
^3)*ln(1+tan(f*x+e)^2)+(a^4*c^3-3*a^4*c*d^2+12*a^3*b*c^2*d-4*a^3*b*d^3-6*a 
^2*b^2*c^3+18*a^2*b^2*c*d^2-12*a*b^3*c^2*d+4*a*b^3*d^3+b^4*c^3-3*b^4*c*d^2 
)*arctan(tan(f*x+e)))-1/2*(a^4*d^4-4*a^3*b*c*d^3+6*a^2*b^2*c^2*d^2-4*a*b^3 
*c^3*d+b^4*c^4)/d^3/(c^2+d^2)/(c+d*tan(f*x+e))^2-(2*a^4*c*d^4-4*a^3*b*c^2* 
d^3+4*a^3*b*d^5-12*a^2*b^2*c*d^4+4*a*b^3*c^4*d+12*a*b^3*c^2*d^3-2*b^4*c^5- 
4*b^4*c^3*d^2)/d^3/(c^2+d^2)^2/(c+d*tan(f*x+e))+(3*a^4*c^2*d^4-a^4*d^6-4*a 
^3*b*c^3*d^3+12*a^3*b*c*d^5-18*a^2*b^2*c^2*d^4+6*a^2*b^2*d^6+4*a*b^3*c^3*d 
^3-12*a*b^3*c*d^5+b^4*c^6+3*b^4*c^4*d^2+6*b^4*c^2*d^4)/(c^2+d^2)^3/d^3*ln( 
c+d*tan(f*x+e)))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1247 vs. \(2 (404) = 808\).

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

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

Output:

1/2*(b^4*c^6*d^2 + 4*a*b^3*c^5*d^3 - 4*a^3*b*c*d^7 - a^4*d^8 - (18*a^2*b^2 
 - 7*b^4)*c^4*d^4 + 20*(a^3*b - a*b^3)*c^3*d^5 - (7*a^4 - 18*a^2*b^2)*c^2* 
d^6 + 2*((a^4 - 6*a^2*b^2 + b^4)*c^5*d^3 + 12*(a^3*b - a*b^3)*c^4*d^4 - 3* 
(a^4 - 6*a^2*b^2 + b^4)*c^3*d^5 - 4*(a^3*b - a*b^3)*c^2*d^6)*f*x - (3*b^4* 
c^6*d^2 - 4*a*b^3*c^5*d^3 - 12*a^3*b*c*d^7 + a^4*d^8 - 3*(2*a^2*b^2 - 3*b^ 
4)*c^4*d^4 + 4*(3*a^3*b - 7*a*b^3)*c^3*d^5 - 5*(a^4 - 6*a^2*b^2)*c^2*d^6 - 
 2*((a^4 - 6*a^2*b^2 + b^4)*c^3*d^5 + 12*(a^3*b - a*b^3)*c^2*d^6 - 3*(a^4 
- 6*a^2*b^2 + b^4)*c*d^7 - 4*(a^3*b - a*b^3)*d^8)*f*x)*tan(f*x + e)^2 + (b 
^4*c^8 + 3*b^4*c^6*d^2 - 4*(a^3*b - a*b^3)*c^5*d^3 + 3*(a^4 - 6*a^2*b^2 + 
2*b^4)*c^4*d^4 + 12*(a^3*b - a*b^3)*c^3*d^5 - (a^4 - 6*a^2*b^2)*c^2*d^6 + 
(b^4*c^6*d^2 + 3*b^4*c^4*d^4 - 4*(a^3*b - a*b^3)*c^3*d^5 + 3*(a^4 - 6*a^2* 
b^2 + 2*b^4)*c^2*d^6 + 12*(a^3*b - a*b^3)*c*d^7 - (a^4 - 6*a^2*b^2)*d^8)*t 
an(f*x + e)^2 + 2*(b^4*c^7*d + 3*b^4*c^5*d^3 - 4*(a^3*b - a*b^3)*c^4*d^4 + 
 3*(a^4 - 6*a^2*b^2 + 2*b^4)*c^3*d^5 + 12*(a^3*b - a*b^3)*c^2*d^6 - (a^4 - 
 6*a^2*b^2)*c*d^7)*tan(f*x + e))*log((d^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + 
 e) + c^2)/(tan(f*x + e)^2 + 1)) - (b^4*c^8 + 3*b^4*c^6*d^2 + 3*b^4*c^4*d^ 
4 + b^4*c^2*d^6 + (b^4*c^6*d^2 + 3*b^4*c^4*d^4 + 3*b^4*c^2*d^6 + b^4*d^8)* 
tan(f*x + e)^2 + 2*(b^4*c^7*d + 3*b^4*c^5*d^3 + 3*b^4*c^3*d^5 + b^4*c*d^7) 
*tan(f*x + e))*log(1/(tan(f*x + e)^2 + 1)) - 2*(b^4*c^7*d + 4*a^3*b*d^8 - 
3*(2*a^2*b^2 - b^4)*c^5*d^3 + 4*(2*a^3*b - 3*a*b^3)*c^4*d^4 - (3*a^4 - ...
 

Sympy [F(-2)]

Exception generated. \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^3} \, dx=\text {Exception raised: AttributeError} \] Input:

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

Output:

Exception raised: AttributeError >> 'NoneType' object has no attribute 'pr 
imitive'
 

Maxima [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 640, normalized size of antiderivative = 1.58 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^3} \, dx=\frac {\frac {2 \, {\left ({\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c^{3} + 12 \, {\left (a^{3} b - a b^{3}\right )} c^{2} d - 3 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c d^{2} - 4 \, {\left (a^{3} b - a b^{3}\right )} d^{3}\right )} {\left (f x + e\right )}}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {2 \, {\left (b^{4} c^{6} + 3 \, b^{4} c^{4} d^{2} - 4 \, {\left (a^{3} b - a b^{3}\right )} c^{3} d^{3} + 3 \, {\left (a^{4} - 6 \, a^{2} b^{2} + 2 \, b^{4}\right )} c^{2} d^{4} + 12 \, {\left (a^{3} b - a b^{3}\right )} c d^{5} - {\left (a^{4} - 6 \, a^{2} b^{2}\right )} d^{6}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{6} d^{3} + 3 \, c^{4} d^{5} + 3 \, c^{2} d^{7} + d^{9}} + \frac {{\left (4 \, {\left (a^{3} b - a b^{3}\right )} c^{3} - 3 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c^{2} d - 12 \, {\left (a^{3} b - a b^{3}\right )} c d^{2} + {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {3 \, b^{4} c^{6} - 4 \, a b^{3} c^{5} d - 4 \, a^{3} b c d^{5} - a^{4} d^{6} - {\left (6 \, a^{2} b^{2} - 7 \, b^{4}\right )} c^{4} d^{2} + 4 \, {\left (3 \, a^{3} b - 5 \, a b^{3}\right )} c^{3} d^{3} - {\left (5 \, a^{4} - 18 \, a^{2} b^{2}\right )} c^{2} d^{4} + 4 \, {\left (b^{4} c^{5} d - 2 \, a b^{3} c^{4} d^{2} + 2 \, b^{4} c^{3} d^{3} - 2 \, a^{3} b d^{6} + 2 \, {\left (a^{3} b - 3 \, a b^{3}\right )} c^{2} d^{4} - {\left (a^{4} - 6 \, a^{2} b^{2}\right )} c d^{5}\right )} \tan \left (f x + e\right )}{c^{6} d^{3} + 2 \, c^{4} d^{5} + c^{2} d^{7} + {\left (c^{4} d^{5} + 2 \, c^{2} d^{7} + d^{9}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (c^{5} d^{4} + 2 \, c^{3} d^{6} + c d^{8}\right )} \tan \left (f x + e\right )}}{2 \, f} \] Input:

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.33 (sec) , antiderivative size = 779, normalized size of antiderivative = 1.92 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^3} \, dx=\frac {{\left (a^{4} c^{3} - 6 \, a^{2} b^{2} c^{3} + b^{4} c^{3} + 12 \, a^{3} b c^{2} d - 12 \, a b^{3} c^{2} d - 3 \, a^{4} c d^{2} + 18 \, a^{2} b^{2} c d^{2} - 3 \, b^{4} c d^{2} - 4 \, a^{3} b d^{3} + 4 \, a b^{3} d^{3}\right )} {\left (f x + e\right )}}{c^{6} f + 3 \, c^{4} d^{2} f + 3 \, c^{2} d^{4} f + d^{6} f} + \frac {{\left (4 \, a^{3} b c^{3} - 4 \, a b^{3} c^{3} - 3 \, a^{4} c^{2} d + 18 \, a^{2} b^{2} c^{2} d - 3 \, b^{4} c^{2} d - 12 \, a^{3} b c d^{2} + 12 \, a b^{3} c d^{2} + a^{4} d^{3} - 6 \, a^{2} b^{2} d^{3} + b^{4} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{2 \, {\left (c^{6} f + 3 \, c^{4} d^{2} f + 3 \, c^{2} d^{4} f + d^{6} f\right )}} + \frac {{\left (b^{4} c^{6} + 3 \, b^{4} c^{4} d^{2} - 4 \, a^{3} b c^{3} d^{3} + 4 \, a b^{3} c^{3} d^{3} + 3 \, a^{4} c^{2} d^{4} - 18 \, a^{2} b^{2} c^{2} d^{4} + 6 \, b^{4} c^{2} d^{4} + 12 \, a^{3} b c d^{5} - 12 \, a b^{3} c d^{5} - a^{4} d^{6} + 6 \, a^{2} b^{2} d^{6}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{6} d^{3} f + 3 \, c^{4} d^{5} f + 3 \, c^{2} d^{7} f + d^{9} f} + \frac {4 \, {\left (b^{4} c^{7} - 2 \, a b^{3} c^{6} d + 3 \, b^{4} c^{5} d^{2} + 2 \, a^{3} b c^{4} d^{3} - 8 \, a b^{3} c^{4} d^{3} - a^{4} c^{3} d^{4} + 6 \, a^{2} b^{2} c^{3} d^{4} + 2 \, b^{4} c^{3} d^{4} - 6 \, a b^{3} c^{2} d^{5} - a^{4} c d^{6} + 6 \, a^{2} b^{2} c d^{6} - 2 \, a^{3} b d^{7}\right )} \tan \left (f x + e\right ) + \frac {3 \, b^{4} c^{8} - 4 \, a b^{3} c^{7} d - 6 \, a^{2} b^{2} c^{6} d^{2} + 10 \, b^{4} c^{6} d^{2} + 12 \, a^{3} b c^{5} d^{3} - 24 \, a b^{3} c^{5} d^{3} - 5 \, a^{4} c^{4} d^{4} + 12 \, a^{2} b^{2} c^{4} d^{4} + 7 \, b^{4} c^{4} d^{4} + 8 \, a^{3} b c^{3} d^{5} - 20 \, a b^{3} c^{3} d^{5} - 6 \, a^{4} c^{2} d^{6} + 18 \, a^{2} b^{2} c^{2} d^{6} - 4 \, a^{3} b c d^{7} - a^{4} d^{8}}{d}}{2 \, {\left (c^{2} + d^{2}\right )}^{3} {\left (d \tan \left (f x + e\right ) + c\right )}^{2} d^{2} f} \] Input:

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

Output:

(a^4*c^3 - 6*a^2*b^2*c^3 + b^4*c^3 + 12*a^3*b*c^2*d - 12*a*b^3*c^2*d - 3*a 
^4*c*d^2 + 18*a^2*b^2*c*d^2 - 3*b^4*c*d^2 - 4*a^3*b*d^3 + 4*a*b^3*d^3)*(f* 
x + e)/(c^6*f + 3*c^4*d^2*f + 3*c^2*d^4*f + d^6*f) + 1/2*(4*a^3*b*c^3 - 4* 
a*b^3*c^3 - 3*a^4*c^2*d + 18*a^2*b^2*c^2*d - 3*b^4*c^2*d - 12*a^3*b*c*d^2 
+ 12*a*b^3*c*d^2 + a^4*d^3 - 6*a^2*b^2*d^3 + b^4*d^3)*log(tan(f*x + e)^2 + 
 1)/(c^6*f + 3*c^4*d^2*f + 3*c^2*d^4*f + d^6*f) + (b^4*c^6 + 3*b^4*c^4*d^2 
 - 4*a^3*b*c^3*d^3 + 4*a*b^3*c^3*d^3 + 3*a^4*c^2*d^4 - 18*a^2*b^2*c^2*d^4 
+ 6*b^4*c^2*d^4 + 12*a^3*b*c*d^5 - 12*a*b^3*c*d^5 - a^4*d^6 + 6*a^2*b^2*d^ 
6)*log(abs(d*tan(f*x + e) + c))/(c^6*d^3*f + 3*c^4*d^5*f + 3*c^2*d^7*f + d 
^9*f) + 1/2*(4*(b^4*c^7 - 2*a*b^3*c^6*d + 3*b^4*c^5*d^2 + 2*a^3*b*c^4*d^3 
- 8*a*b^3*c^4*d^3 - a^4*c^3*d^4 + 6*a^2*b^2*c^3*d^4 + 2*b^4*c^3*d^4 - 6*a* 
b^3*c^2*d^5 - a^4*c*d^6 + 6*a^2*b^2*c*d^6 - 2*a^3*b*d^7)*tan(f*x + e) + (3 
*b^4*c^8 - 4*a*b^3*c^7*d - 6*a^2*b^2*c^6*d^2 + 10*b^4*c^6*d^2 + 12*a^3*b*c 
^5*d^3 - 24*a*b^3*c^5*d^3 - 5*a^4*c^4*d^4 + 12*a^2*b^2*c^4*d^4 + 7*b^4*c^4 
*d^4 + 8*a^3*b*c^3*d^5 - 20*a*b^3*c^3*d^5 - 6*a^4*c^2*d^6 + 18*a^2*b^2*c^2 
*d^6 - 4*a^3*b*c*d^7 - a^4*d^8)/d)/((c^2 + d^2)^3*(d*tan(f*x + e) + c)^2*d 
^2*f)
 

Mupad [B] (verification not implemented)

Time = 7.57 (sec) , antiderivative size = 578, normalized size of antiderivative = 1.42 \[ \int \frac {(a+b \tan (e+f x))^4}{(c+d \tan (e+f x))^3} \, dx=-\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (\frac {d^6\,\left (a^4-6\,a^2\,b^2\right )-c^2\,\left (d^4\,\left (3\,a^4-18\,a^2\,b^2+6\,b^4\right )-3\,b^4\,d^4\right )+b^4\,d^6-c^3\,d^3\,\left (4\,a\,b^3-4\,a^3\,b\right )+c\,d^5\,\left (12\,a\,b^3-12\,a^3\,b\right )}{c^6\,d^3+3\,c^4\,d^5+3\,c^2\,d^7+d^9}-\frac {b^4}{d^3}\right )}{f}-\frac {\frac {5\,a^4\,c^2\,d^4+a^4\,d^6-12\,a^3\,b\,c^3\,d^3+4\,a^3\,b\,c\,d^5+6\,a^2\,b^2\,c^4\,d^2-18\,a^2\,b^2\,c^2\,d^4+4\,a\,b^3\,c^5\,d+20\,a\,b^3\,c^3\,d^3-3\,b^4\,c^6-7\,b^4\,c^4\,d^2}{2\,d^3\,\left (c^4+2\,c^2\,d^2+d^4\right )}-\frac {2\,\mathrm {tan}\left (e+f\,x\right )\,\left (-a^4\,c\,d^4+2\,a^3\,b\,c^2\,d^3-2\,a^3\,b\,d^5+6\,a^2\,b^2\,c\,d^4-2\,a\,b^3\,c^4\,d-6\,a\,b^3\,c^2\,d^3+b^4\,c^5+2\,b^4\,c^3\,d^2\right )}{d^2\,\left (c^4+2\,c^2\,d^2+d^4\right )}}{f\,\left (c^2+2\,c\,d\,\mathrm {tan}\left (e+f\,x\right )+d^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^4-a^3\,b\,4{}\mathrm {i}-6\,a^2\,b^2+a\,b^3\,4{}\mathrm {i}+b^4\right )}{2\,f\,\left (-c^3\,1{}\mathrm {i}-3\,c^2\,d+c\,d^2\,3{}\mathrm {i}+d^3\right )}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (a^4\,1{}\mathrm {i}-4\,a^3\,b-a^2\,b^2\,6{}\mathrm {i}+4\,a\,b^3+b^4\,1{}\mathrm {i}\right )}{2\,f\,\left (-c^3-c^2\,d\,3{}\mathrm {i}+3\,c\,d^2+d^3\,1{}\mathrm {i}\right )} \] Input:

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

Output:

(log(tan(e + f*x) + 1i)*(a*b^3*4i - a^3*b*4i + a^4 + b^4 - 6*a^2*b^2))/(2* 
f*(c*d^2*3i - 3*c^2*d - c^3*1i + d^3)) - ((a^4*d^6 - 3*b^4*c^6 + 5*a^4*c^2 
*d^4 - 7*b^4*c^4*d^2 + 20*a*b^3*c^3*d^3 - 12*a^3*b*c^3*d^3 - 18*a^2*b^2*c^ 
2*d^4 + 6*a^2*b^2*c^4*d^2 + 4*a*b^3*c^5*d + 4*a^3*b*c*d^5)/(2*d^3*(c^4 + d 
^4 + 2*c^2*d^2)) - (2*tan(e + f*x)*(b^4*c^5 - 2*a^3*b*d^5 - a^4*c*d^4 + 2* 
b^4*c^3*d^2 - 6*a*b^3*c^2*d^3 + 6*a^2*b^2*c*d^4 + 2*a^3*b*c^2*d^3 - 2*a*b^ 
3*c^4*d))/(d^2*(c^4 + d^4 + 2*c^2*d^2)))/(f*(c^2 + d^2*tan(e + f*x)^2 + 2* 
c*d*tan(e + f*x))) - (log(c + d*tan(e + f*x))*((d^6*(a^4 - 6*a^2*b^2) - c^ 
2*(d^4*(3*a^4 + 6*b^4 - 18*a^2*b^2) - 3*b^4*d^4) + b^4*d^6 - c^3*d^3*(4*a* 
b^3 - 4*a^3*b) + c*d^5*(12*a*b^3 - 12*a^3*b))/(d^9 + 3*c^2*d^7 + 3*c^4*d^5 
 + c^6*d^3) - b^4/d^3))/f + (log(tan(e + f*x) - 1i)*(4*a*b^3 - 4*a^3*b + a 
^4*1i + b^4*1i - a^2*b^2*6i))/(2*f*(3*c*d^2 - c^2*d*3i - c^3 + d^3*1i))
 

Reduce [B] (verification not implemented)

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

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

Output:

( - 3*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**2*a**4*c**3*d**6 + log(tan(e 
+ f*x)**2 + 1)*tan(e + f*x)**2*a**4*c*d**8 + 4*log(tan(e + f*x)**2 + 1)*ta 
n(e + f*x)**2*a**3*b*c**4*d**5 - 12*log(tan(e + f*x)**2 + 1)*tan(e + f*x)* 
*2*a**3*b*c**2*d**7 + 18*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**2*a**2*b** 
2*c**3*d**6 - 6*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**2*a**2*b**2*c*d**8 
- 4*log(tan(e + f*x)**2 + 1)*tan(e + f*x)**2*a*b**3*c**4*d**5 + 12*log(tan 
(e + f*x)**2 + 1)*tan(e + f*x)**2*a*b**3*c**2*d**7 - 3*log(tan(e + f*x)**2 
 + 1)*tan(e + f*x)**2*b**4*c**3*d**6 + log(tan(e + f*x)**2 + 1)*tan(e + f* 
x)**2*b**4*c*d**8 - 6*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**4*c**4*d**5 
 + 2*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**4*c**2*d**7 + 8*log(tan(e + 
f*x)**2 + 1)*tan(e + f*x)*a**3*b*c**5*d**4 - 24*log(tan(e + f*x)**2 + 1)*t 
an(e + f*x)*a**3*b*c**3*d**6 + 36*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a* 
*2*b**2*c**4*d**5 - 12*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**2*b**2*c** 
2*d**7 - 8*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a*b**3*c**5*d**4 + 24*log 
(tan(e + f*x)**2 + 1)*tan(e + f*x)*a*b**3*c**3*d**6 - 6*log(tan(e + f*x)** 
2 + 1)*tan(e + f*x)*b**4*c**4*d**5 + 2*log(tan(e + f*x)**2 + 1)*tan(e + f* 
x)*b**4*c**2*d**7 - 3*log(tan(e + f*x)**2 + 1)*a**4*c**5*d**4 + log(tan(e 
+ f*x)**2 + 1)*a**4*c**3*d**6 + 4*log(tan(e + f*x)**2 + 1)*a**3*b*c**6*d** 
3 - 12*log(tan(e + f*x)**2 + 1)*a**3*b*c**4*d**5 + 18*log(tan(e + f*x)**2 
+ 1)*a**2*b**2*c**5*d**4 - 6*log(tan(e + f*x)**2 + 1)*a**2*b**2*c**3*d*...