\(\int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx\) [344]

Optimal result
Mathematica [C] (warning: unable to verify)
Rubi [A] (verified)
Maple [A] (verified)
Fricas [B] (verification not implemented)
Sympy [F]
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 = 59 \[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {x}{a}-\frac {(a+b)^{3/2} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{a b^{3/2} f}+\frac {\tan (e+f x)}{b f} \] Output:

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

Mathematica [C] (warning: unable to verify)

Result contains complex when optimal does not.

Time = 1.18 (sec) , antiderivative size = 206, normalized size of antiderivative = 3.49 \[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {(a+2 b+a \cos (2 (e+f x))) \sec ^2(e+f x) \left ((a+b)^2 \arctan \left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))+\sqrt {a+b} \sqrt {b (i \cos (e)+\sin (e))^4} (b f x+a \sec (e) \sec (e+f x) \sin (f x))\right )}{2 a b \sqrt {a+b} f \left (a+b \sec ^2(e+f x)\right ) \sqrt {b (\cos (e)-i \sin (e))^4}} \] Input:

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

Output:

((a + 2*b + a*Cos[2*(e + f*x)])*Sec[e + f*x]^2*((a + b)^2*ArcTan[(Sec[f*x] 
*(Cos[2*e] - I*Sin[2*e])*(-((a + 2*b)*Sin[f*x]) + a*Sin[2*e + f*x]))/(2*Sq 
rt[a + b]*Sqrt[b*(Cos[e] - I*Sin[e])^4])]*(Cos[2*e] - I*Sin[2*e]) + Sqrt[a 
 + b]*Sqrt[b*(I*Cos[e] + Sin[e])^4]*(b*f*x + a*Sec[e]*Sec[e + f*x]*Sin[f*x 
])))/(2*a*b*Sqrt[a + b]*f*(a + b*Sec[e + f*x]^2)*Sqrt[b*(Cos[e] - I*Sin[e] 
)^4])
 

Rubi [A] (verified)

Time = 0.33 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.19, number of steps used = 8, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.304, Rules used = {3042, 4629, 2075, 381, 397, 216, 218}

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

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {\tan (e+f x)^4}{a+b \sec (e+f x)^2}dx\)

\(\Big \downarrow \) 4629

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

\(\Big \downarrow \) 2075

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

\(\Big \downarrow \) 381

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

\(\Big \downarrow \) 397

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

\(\Big \downarrow \) 216

\(\displaystyle \frac {\frac {\tan (e+f x)}{b}-\frac {\frac {(a+b)^2 \int \frac {1}{b \tan ^2(e+f x)+a+b}d\tan (e+f x)}{a}-\frac {b \arctan (\tan (e+f x))}{a}}{b}}{f}\)

\(\Big \downarrow \) 218

\(\displaystyle \frac {\frac {\tan (e+f x)}{b}-\frac {\frac {(a+b)^{3/2} \arctan \left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{a \sqrt {b}}-\frac {b \arctan (\tan (e+f x))}{a}}{b}}{f}\)

Input:

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

Output:

(-((-((b*ArcTan[Tan[e + f*x]])/a) + ((a + b)^(3/2)*ArcTan[(Sqrt[b]*Tan[e + 
 f*x])/Sqrt[a + b]])/(a*Sqrt[b]))/b) + Tan[e + f*x]/b)/f
 

Defintions of rubi rules used

rule 216
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*A 
rcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a 
, 0] || GtQ[b, 0])
 

rule 218
Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/R 
t[a/b, 2]], x] /; FreeQ[{a, b}, x] && PosQ[a/b]
 

rule 381
Int[((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_ 
), x_Symbol] :> Simp[e^3*(e*x)^(m - 3)*(a + b*x^2)^(p + 1)*((c + d*x^2)^(q 
+ 1)/(b*d*(m + 2*(p + q) + 1))), x] - Simp[e^4/(b*d*(m + 2*(p + q) + 1)) 
Int[(e*x)^(m - 4)*(a + b*x^2)^p*(c + d*x^2)^q*Simp[a*c*(m - 3) + (a*d*(m + 
2*q - 1) + b*c*(m + 2*p - 1))*x^2, x], x], x] /; FreeQ[{a, b, c, d, e, p, q 
}, x] && NeQ[b*c - a*d, 0] && GtQ[m, 3] && IntBinomialQ[a, b, c, d, e, m, 2 
, p, q, x]
 

rule 397
Int[((e_) + (f_.)*(x_)^2)/(((a_) + (b_.)*(x_)^2)*((c_) + (d_.)*(x_)^2)), x_ 
Symbol] :> Simp[(b*e - a*f)/(b*c - a*d)   Int[1/(a + b*x^2), x], x] - Simp[ 
(d*e - c*f)/(b*c - a*d)   Int[1/(c + d*x^2), x], x] /; FreeQ[{a, b, c, d, e 
, f}, x]
 

rule 2075
Int[(u_)^(p_.)*(v_)^(q_.)*((e_.)*(x_))^(m_.), x_Symbol] :> Int[(e*x)^m*Expa 
ndToSum[u, x]^p*ExpandToSum[v, x]^q, x] /; FreeQ[{e, m, p, q}, x] && Binomi 
alQ[{u, v}, x] && EqQ[BinomialDegree[u, x] - BinomialDegree[v, x], 0] &&  ! 
BinomialMatchQ[{u, v}, x]
 

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

rule 4629
Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*((d_.)*tan[(e_.) + (f 
_.)*(x_)])^(m_), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Sim 
p[ff/f   Subst[Int[(d*ff*x)^m*((a + b*(1 + ff^2*x^2)^(n/2))^p/(1 + ff^2*x^2 
)), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, d, e, f, m, p}, x] && Inte 
gerQ[n/2] && (IntegerQ[m/2] || EqQ[n, 2])
 
Maple [A] (verified)

Time = 1.00 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.22

method result size
derivativedivides \(\frac {\frac {\tan \left (f x +e \right )}{b}+\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a}+\frac {\left (-a^{2}-2 a b -b^{2}\right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a b \sqrt {\left (a +b \right ) b}}}{f}\) \(72\)
default \(\frac {\frac {\tan \left (f x +e \right )}{b}+\frac {\arctan \left (\tan \left (f x +e \right )\right )}{a}+\frac {\left (-a^{2}-2 a b -b^{2}\right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a b \sqrt {\left (a +b \right ) b}}}{f}\) \(72\)
risch \(\frac {x}{a}+\frac {2 i}{f b \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}+a +2 b}{a}\right )}{2 b^{2} f}+\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}+a +2 b}{a}\right )}{2 b f a}-\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}-a -2 b}{a}\right )}{2 b^{2} f}-\frac {\sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}-a -2 b}{a}\right )}{2 b f a}\) \(229\)

Input:

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

Output:

1/f*(tan(f*x+e)/b+1/a*arctan(tan(f*x+e))+(-a^2-2*a*b-b^2)/a/b/((a+b)*b)^(1 
/2)*arctan(b*tan(f*x+e)/((a+b)*b)^(1/2)))
 

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 110 vs. \(2 (51) = 102\).

Time = 0.11 (sec) , antiderivative size = 297, normalized size of antiderivative = 5.03 \[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\left [\frac {4 \, b f x \cos \left (f x + e\right ) + {\left (a + b\right )} \sqrt {-\frac {a + b}{b}} \cos \left (f x + e\right ) \log \left (\frac {{\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 4 \, {\left ({\left (a b + 2 \, b^{2}\right )} \cos \left (f x + e\right )^{3} - b^{2} \cos \left (f x + e\right )\right )} \sqrt {-\frac {a + b}{b}} \sin \left (f x + e\right ) + b^{2}}{a^{2} \cos \left (f x + e\right )^{4} + 2 \, a b \cos \left (f x + e\right )^{2} + b^{2}}\right ) + 4 \, a \sin \left (f x + e\right )}{4 \, a b f \cos \left (f x + e\right )}, \frac {2 \, b f x \cos \left (f x + e\right ) + {\left (a + b\right )} \sqrt {\frac {a + b}{b}} \arctan \left (\frac {{\left ({\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{2} - b\right )} \sqrt {\frac {a + b}{b}}}{2 \, {\left (a + b\right )} \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) \cos \left (f x + e\right ) + 2 \, a \sin \left (f x + e\right )}{2 \, a b f \cos \left (f x + e\right )}\right ] \] Input:

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

Output:

[1/4*(4*b*f*x*cos(f*x + e) + (a + b)*sqrt(-(a + b)/b)*cos(f*x + e)*log(((a 
^2 + 8*a*b + 8*b^2)*cos(f*x + e)^4 - 2*(3*a*b + 4*b^2)*cos(f*x + e)^2 + 4* 
((a*b + 2*b^2)*cos(f*x + e)^3 - b^2*cos(f*x + e))*sqrt(-(a + b)/b)*sin(f*x 
 + e) + b^2)/(a^2*cos(f*x + e)^4 + 2*a*b*cos(f*x + e)^2 + b^2)) + 4*a*sin( 
f*x + e))/(a*b*f*cos(f*x + e)), 1/2*(2*b*f*x*cos(f*x + e) + (a + b)*sqrt(( 
a + b)/b)*arctan(1/2*((a + 2*b)*cos(f*x + e)^2 - b)*sqrt((a + b)/b)/((a + 
b)*cos(f*x + e)*sin(f*x + e)))*cos(f*x + e) + 2*a*sin(f*x + e))/(a*b*f*cos 
(f*x + e))]
 

Sympy [F]

\[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\int \frac {\tan ^{4}{\left (e + f x \right )}}{a + b \sec ^{2}{\left (e + f x \right )}}\, dx \] Input:

integrate(tan(f*x+e)**4/(a+b*sec(f*x+e)**2),x)
 

Output:

Integral(tan(e + f*x)**4/(a + b*sec(e + f*x)**2), x)
 

Maxima [A] (verification not implemented)

Time = 0.11 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.12 \[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\frac {f x + e}{a} + \frac {\tan \left (f x + e\right )}{b} - \frac {{\left (a^{2} + 2 \, a b + b^{2}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a b}}{f} \] Input:

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

Output:

((f*x + e)/a + tan(f*x + e)/b - (a^2 + 2*a*b + b^2)*arctan(b*tan(f*x + e)/ 
sqrt((a + b)*b))/(sqrt((a + b)*b)*a*b))/f
 

Giac [A] (verification not implemented)

Time = 0.30 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.27 \[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {f x + e}{a f} + \frac {\tan \left (f x + e\right )}{b f} - \frac {{\left (a^{2} + 2 \, a b + b^{2}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right )}{\sqrt {a b + b^{2}} a b f} \] Input:

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

Output:

(f*x + e)/(a*f) + tan(f*x + e)/(b*f) - (a^2 + 2*a*b + b^2)*arctan(b*tan(f* 
x + e)/sqrt(a*b + b^2))/(sqrt(a*b + b^2)*a*b*f)
 

Mupad [B] (verification not implemented)

Time = 15.14 (sec) , antiderivative size = 410, normalized size of antiderivative = 6.95 \[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {\mathrm {atan}\left (\frac {8\,a^2\,\mathrm {tan}\left (e+f\,x\right )}{12\,a\,b+8\,a^2+6\,b^2+\frac {2\,a^3}{b}}+\frac {2\,a^3\,\mathrm {tan}\left (e+f\,x\right )}{2\,a^3+8\,a^2\,b+12\,a\,b^2+6\,b^3}+\frac {6\,b^2\,\mathrm {tan}\left (e+f\,x\right )}{12\,a\,b+8\,a^2+6\,b^2+\frac {2\,a^3}{b}}+\frac {12\,a\,b\,\mathrm {tan}\left (e+f\,x\right )}{12\,a\,b+8\,a^2+6\,b^2+\frac {2\,a^3}{b}}\right )}{a\,f}+\frac {\mathrm {tan}\left (e+f\,x\right )}{b\,f}+\frac {\mathrm {atanh}\left (\frac {6\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^3-3\,a^2\,b^4-3\,a\,b^5-b^6}}{18\,a\,b^2+20\,a^2\,b+10\,a^3+6\,b^3+\frac {2\,a^4}{b}}+\frac {6\,a\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^3-3\,a^2\,b^4-3\,a\,b^5-b^6}}{2\,a^4+10\,a^3\,b+20\,a^2\,b^2+18\,a\,b^3+6\,b^4}+\frac {2\,a^2\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-a^3\,b^3-3\,a^2\,b^4-3\,a\,b^5-b^6}}{2\,a^4\,b+10\,a^3\,b^2+20\,a^2\,b^3+18\,a\,b^4+6\,b^5}\right )\,\sqrt {-b^3\,{\left (a+b\right )}^3}}{a\,b^3\,f} \] Input:

int(tan(e + f*x)^4/(a + b/cos(e + f*x)^2),x)
                                                                                    
                                                                                    
 

Output:

atan((8*a^2*tan(e + f*x))/(12*a*b + 8*a^2 + 6*b^2 + (2*a^3)/b) + (2*a^3*ta 
n(e + f*x))/(12*a*b^2 + 8*a^2*b + 2*a^3 + 6*b^3) + (6*b^2*tan(e + f*x))/(1 
2*a*b + 8*a^2 + 6*b^2 + (2*a^3)/b) + (12*a*b*tan(e + f*x))/(12*a*b + 8*a^2 
 + 6*b^2 + (2*a^3)/b))/(a*f) + tan(e + f*x)/(b*f) + (atanh((6*tan(e + f*x) 
*(- 3*a*b^5 - b^6 - 3*a^2*b^4 - a^3*b^3)^(1/2))/(18*a*b^2 + 20*a^2*b + 10* 
a^3 + 6*b^3 + (2*a^4)/b) + (6*a*tan(e + f*x)*(- 3*a*b^5 - b^6 - 3*a^2*b^4 
- a^3*b^3)^(1/2))/(18*a*b^3 + 10*a^3*b + 2*a^4 + 6*b^4 + 20*a^2*b^2) + (2* 
a^2*tan(e + f*x)*(- 3*a*b^5 - b^6 - 3*a^2*b^4 - a^3*b^3)^(1/2))/(18*a*b^4 
+ 2*a^4*b + 6*b^5 + 20*a^2*b^3 + 10*a^3*b^2))*(-b^3*(a + b)^3)^(1/2))/(a*b 
^3*f)
 

Reduce [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 196, normalized size of antiderivative = 3.32 \[ \int \frac {\tan ^4(e+f x)}{a+b \sec ^2(e+f x)} \, dx=\frac {-\sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-\sqrt {a}}{\sqrt {b}}\right ) \cos \left (f x +e \right ) a -\sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )-\sqrt {a}}{\sqrt {b}}\right ) \cos \left (f x +e \right ) b -\sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+\sqrt {a}}{\sqrt {b}}\right ) \cos \left (f x +e \right ) a -\sqrt {b}\, \sqrt {a +b}\, \mathit {atan} \left (\frac {\sqrt {a +b}\, \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+\sqrt {a}}{\sqrt {b}}\right ) \cos \left (f x +e \right ) b +\cos \left (f x +e \right ) b^{2} f x +\sin \left (f x +e \right ) a b}{\cos \left (f x +e \right ) a \,b^{2} f} \] Input:

int(tan(f*x+e)^4/(a+b*sec(f*x+e)^2),x)
 

Output:

( - sqrt(b)*sqrt(a + b)*atan((sqrt(a + b)*tan((e + f*x)/2) - sqrt(a))/sqrt 
(b))*cos(e + f*x)*a - sqrt(b)*sqrt(a + b)*atan((sqrt(a + b)*tan((e + f*x)/ 
2) - sqrt(a))/sqrt(b))*cos(e + f*x)*b - sqrt(b)*sqrt(a + b)*atan((sqrt(a + 
 b)*tan((e + f*x)/2) + sqrt(a))/sqrt(b))*cos(e + f*x)*a - sqrt(b)*sqrt(a + 
 b)*atan((sqrt(a + b)*tan((e + f*x)/2) + sqrt(a))/sqrt(b))*cos(e + f*x)*b 
+ cos(e + f*x)*b**2*f*x + sin(e + f*x)*a*b)/(cos(e + f*x)*a*b**2*f)