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

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

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

Mathematica [C] (verified)

Result contains complex when optimal does not.

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

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

Output:

(((I*c - d)^3*Log[I - Tan[e + f*x]])/(a + I*b)^2 - ((I*c + d)^3*Log[I + Ta 
n[e + f*x]])/(a - I*b)^2 + (2*(b*c - a*d)^2*(2*a*b*c + a^2*d + 3*b^2*d)*Lo 
g[a + b*Tan[e + f*x]])/(b^2*(a^2 + b^2)^2) - (2*(b*c - a*d)^3)/(b^2*(a^2 + 
 b^2)*(a + b*Tan[e + f*x])))/(2*f)
 

Rubi [A] (verified)

Time = 1.00 (sec) , antiderivative size = 246, normalized size of antiderivative = 1.07, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.320, Rules used = {3042, 4048, 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 {(c+d \tan (e+f x))^3}{(a+b \tan (e+f x))^2} \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4048

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4109

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

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 3956

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

\(\Big \downarrow \) 4100

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

\(\Big \downarrow \) 16

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

Input:

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

Output:

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

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

Time = 0.22 (sec) , antiderivative size = 281, normalized size of antiderivative = 1.22

method result size
derivativedivides \(\frac {-\frac {-a^{3} d^{3}+3 a^{2} b c \,d^{2}-3 a \,b^{2} c^{2} d +b^{3} c^{3}}{b^{2} \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}+\frac {\left (a^{4} d^{3}-3 a^{2} b^{2} c^{2} d +3 a^{2} b^{2} d^{3}+2 a \,c^{3} b^{3}-6 a \,b^{3} c \,d^{2}+3 b^{4} c^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2} b^{2}}+\frac {\frac {\left (3 a^{2} c^{2} d -a^{2} d^{3}-2 a b \,c^{3}+6 a b c \,d^{2}-3 b^{2} c^{2} d +b^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{2} c^{3}-3 a^{2} c \,d^{2}+6 a b \,c^{2} d -2 a b \,d^{3}-b^{2} c^{3}+3 b^{2} c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{f}\) \(281\)
default \(\frac {-\frac {-a^{3} d^{3}+3 a^{2} b c \,d^{2}-3 a \,b^{2} c^{2} d +b^{3} c^{3}}{b^{2} \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (f x +e \right )\right )}+\frac {\left (a^{4} d^{3}-3 a^{2} b^{2} c^{2} d +3 a^{2} b^{2} d^{3}+2 a \,c^{3} b^{3}-6 a \,b^{3} c \,d^{2}+3 b^{4} c^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2} b^{2}}+\frac {\frac {\left (3 a^{2} c^{2} d -a^{2} d^{3}-2 a b \,c^{3}+6 a b c \,d^{2}-3 b^{2} c^{2} d +b^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}+\left (a^{2} c^{3}-3 a^{2} c \,d^{2}+6 a b \,c^{2} d -2 a b \,d^{3}-b^{2} c^{3}+3 b^{2} c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (a^{2}+b^{2}\right )^{2}}}{f}\) \(281\)
norman \(\frac {\frac {a \left (a^{2} c^{3}-3 a^{2} c \,d^{2}+6 a b \,c^{2} d -2 a b \,d^{3}-b^{2} c^{3}+3 b^{2} c \,d^{2}\right ) x}{a^{4}+2 a^{2} b^{2}+b^{4}}+\frac {a^{3} d^{3}-3 a^{2} b c \,d^{2}+3 a \,b^{2} c^{2} d -b^{3} c^{3}}{\left (a^{2}+b^{2}\right ) b^{2} f}+\frac {b \left (a^{2} c^{3}-3 a^{2} c \,d^{2}+6 a b \,c^{2} d -2 a b \,d^{3}-b^{2} c^{3}+3 b^{2} c \,d^{2}\right ) x \tan \left (f x +e \right )}{a^{4}+2 a^{2} b^{2}+b^{4}}}{a +b \tan \left (f x +e \right )}+\frac {\left (a^{4} d^{3}-3 a^{2} b^{2} c^{2} d +3 a^{2} b^{2} d^{3}+2 a \,c^{3} b^{3}-6 a \,b^{3} c \,d^{2}+3 b^{4} c^{2} d \right ) \ln \left (a +b \tan \left (f x +e \right )\right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) f \,b^{2}}+\frac {\left (3 a^{2} c^{2} d -a^{2} d^{3}-2 a b \,c^{3}+6 a b c \,d^{2}-3 b^{2} c^{2} d +b^{2} d^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}\) \(388\)
parallelrisch \(\frac {-6 a^{2} b^{3} c \,d^{2}+6 b^{4} c^{2} d a -6 a^{4} c \,d^{2} b +6 a^{3} b^{2} c^{2} d -2 b^{5} c^{3}+2 a^{3} b^{2} d^{3}-2 a^{2} b^{3} c^{3}+2 a^{5} d^{3}+2 x \,a^{3} b^{2} c^{3} f -4 x \,a^{2} b^{3} d^{3} f -2 x a \,b^{4} c^{3} f -\ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a^{2} b^{3} d^{3}-2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a \,b^{4} c^{3}-3 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) b^{5} c^{2} d +2 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{4} b \,d^{3}+6 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} b^{3} d^{3}+4 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a \,b^{4} c^{3}+6 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) b^{5} c^{2} d +3 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} b^{2} c^{2} d +6 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} b^{3} c \,d^{2}-3 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,b^{4} c^{2} d -6 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{3} b^{2} c^{2} d -12 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{2} b^{3} c \,d^{2}+6 \ln \left (a +b \tan \left (f x +e \right )\right ) a \,b^{4} c^{2} d +4 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{2} b^{3} c^{3}+\ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) b^{5} d^{3}-\ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{3} b^{2} d^{3}-2 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) a^{2} b^{3} c^{3}+\ln \left (1+\tan \left (f x +e \right )^{2}\right ) a \,b^{4} d^{3}+6 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{3} b^{2} d^{3}+2 x \tan \left (f x +e \right ) a^{2} b^{3} c^{3} f -4 x \tan \left (f x +e \right ) a \,b^{4} d^{3} f +6 x \tan \left (f x +e \right ) b^{5} c \,d^{2} f -6 x \,a^{3} b^{2} c \,d^{2} f +12 x \,a^{2} b^{3} c^{2} d f +6 x a \,b^{4} c \,d^{2} f +3 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a^{2} b^{3} c^{2} d +6 \ln \left (1+\tan \left (f x +e \right )^{2}\right ) \tan \left (f x +e \right ) a \,b^{4} c \,d^{2}-6 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a^{2} b^{3} c^{2} d -12 \ln \left (a +b \tan \left (f x +e \right )\right ) \tan \left (f x +e \right ) a \,b^{4} c \,d^{2}+2 \ln \left (a +b \tan \left (f x +e \right )\right ) a^{5} d^{3}-6 x \tan \left (f x +e \right ) a^{2} b^{3} c \,d^{2} f +12 x \tan \left (f x +e \right ) a \,b^{4} c^{2} d f -2 x \tan \left (f x +e \right ) b^{5} c^{3} f}{2 \left (a +b \tan \left (f x +e \right )\right ) \left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) f \,b^{2}}\) \(887\)
risch \(\text {Expression too large to display}\) \(1079\)

Input:

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

Output:

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 501 vs. \(2 (230) = 460\).

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

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

Output:

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

Sympy [C] (verification not implemented)

Result contains complex when optimal does not.

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

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

Output:

Piecewise((zoo*x*(c + d*tan(e))**3/tan(e)**2, Eq(a, 0) & Eq(b, 0) & Eq(f, 
0)), ((c**3*x + 3*c**2*d*log(tan(e + f*x)**2 + 1)/(2*f) - 3*c*d**2*x + 3*c 
*d**2*tan(e + f*x)/f - d**3*log(tan(e + f*x)**2 + 1)/(2*f) + d**3*tan(e + 
f*x)**2/(2*f))/a**2, Eq(b, 0)), (-c**3*f*x*tan(e + f*x)**2/(4*b**2*f*tan(e 
 + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + 2*I*c**3*f*x*tan(e + f* 
x)/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + c**3* 
f*x/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) - c**3 
*tan(e + f*x)/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2 
*f) + 2*I*c**3/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b** 
2*f) + 3*I*c**2*d*f*x*tan(e + f*x)**2/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2 
*f*tan(e + f*x) - 4*b**2*f) + 6*c**2*d*f*x*tan(e + f*x)/(4*b**2*f*tan(e + 
f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) - 3*I*c**2*d*f*x/(4*b**2*f*t 
an(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + 3*I*c**2*d*tan(e + 
f*x)/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + 3*c 
*d**2*f*x*tan(e + f*x)**2/(4*b**2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f 
*x) - 4*b**2*f) - 6*I*c*d**2*f*x*tan(e + f*x)/(4*b**2*f*tan(e + f*x)**2 - 
8*I*b**2*f*tan(e + f*x) - 4*b**2*f) - 3*c*d**2*f*x/(4*b**2*f*tan(e + f*x)* 
*2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) - 9*c*d**2*tan(e + f*x)/(4*b**2*f 
*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + 6*I*c*d**2/(4*b** 
2*f*tan(e + f*x)**2 - 8*I*b**2*f*tan(e + f*x) - 4*b**2*f) + 3*I*d**3*f*...
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

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

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

Output:

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

Mupad [B] (verification not implemented)

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

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

Output:

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

Reduce [B] (verification not implemented)

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

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

Output:

(3*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**3*b**3*c**2*d - log(tan(e + f* 
x)**2 + 1)*tan(e + f*x)*a**3*b**3*d**3 - 2*log(tan(e + f*x)**2 + 1)*tan(e 
+ f*x)*a**2*b**4*c**3 + 6*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a**2*b**4* 
c*d**2 - 3*log(tan(e + f*x)**2 + 1)*tan(e + f*x)*a*b**5*c**2*d + log(tan(e 
 + f*x)**2 + 1)*tan(e + f*x)*a*b**5*d**3 + 3*log(tan(e + f*x)**2 + 1)*a**4 
*b**2*c**2*d - log(tan(e + f*x)**2 + 1)*a**4*b**2*d**3 - 2*log(tan(e + f*x 
)**2 + 1)*a**3*b**3*c**3 + 6*log(tan(e + f*x)**2 + 1)*a**3*b**3*c*d**2 - 3 
*log(tan(e + f*x)**2 + 1)*a**2*b**4*c**2*d + log(tan(e + f*x)**2 + 1)*a**2 
*b**4*d**3 + 2*log(tan(e + f*x)*b + a)*tan(e + f*x)*a**5*b*d**3 - 6*log(ta 
n(e + f*x)*b + a)*tan(e + f*x)*a**3*b**3*c**2*d + 6*log(tan(e + f*x)*b + a 
)*tan(e + f*x)*a**3*b**3*d**3 + 4*log(tan(e + f*x)*b + a)*tan(e + f*x)*a** 
2*b**4*c**3 - 12*log(tan(e + f*x)*b + a)*tan(e + f*x)*a**2*b**4*c*d**2 + 6 
*log(tan(e + f*x)*b + a)*tan(e + f*x)*a*b**5*c**2*d + 2*log(tan(e + f*x)*b 
 + a)*a**6*d**3 - 6*log(tan(e + f*x)*b + a)*a**4*b**2*c**2*d + 6*log(tan(e 
 + f*x)*b + a)*a**4*b**2*d**3 + 4*log(tan(e + f*x)*b + a)*a**3*b**3*c**3 - 
 12*log(tan(e + f*x)*b + a)*a**3*b**3*c*d**2 + 6*log(tan(e + f*x)*b + a)*a 
**2*b**4*c**2*d - 2*tan(e + f*x)*a**5*b*d**3 + 6*tan(e + f*x)*a**4*b**2*c* 
d**2 + 2*tan(e + f*x)*a**3*b**3*c**3*f*x - 6*tan(e + f*x)*a**3*b**3*c**2*d 
 - 6*tan(e + f*x)*a**3*b**3*c*d**2*f*x - 2*tan(e + f*x)*a**3*b**3*d**3 + 2 
*tan(e + f*x)*a**2*b**4*c**3 + 12*tan(e + f*x)*a**2*b**4*c**2*d*f*x + 6...