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

Optimal result
Mathematica [A] (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 = 32 \[ \int \left (a+b \sec ^2(e+f x)\right ) \tan ^2(e+f x) \, dx=-a x+\frac {a \tan (e+f x)}{f}+\frac {b \tan ^3(e+f x)}{3 f} \] Output:

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

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 41, normalized size of antiderivative = 1.28 \[ \int \left (a+b \sec ^2(e+f x)\right ) \tan ^2(e+f x) \, dx=-\frac {a \arctan (\tan (e+f x))}{f}+\frac {a \tan (e+f x)}{f}+\frac {b \tan ^3(e+f x)}{3 f} \] Input:

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

Output:

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

Rubi [A] (verified)

Time = 0.26 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.12, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3042, 4629, 2075, 363, 262, 216}

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(e+f x) \left (a+b \sec ^2(e+f x)\right ) \, dx\)

\(\Big \downarrow \) 3042

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

\(\Big \downarrow \) 4629

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

\(\Big \downarrow \) 2075

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

\(\Big \downarrow \) 363

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

\(\Big \downarrow \) 262

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

\(\Big \downarrow \) 216

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

Input:

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

Output:

((b*Tan[e + f*x]^3)/3 + a*(-ArcTan[Tan[e + f*x]] + Tan[e + f*x]))/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 262
Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> Simp[c*(c*x) 
^(m - 1)*((a + b*x^2)^(p + 1)/(b*(m + 2*p + 1))), x] - Simp[a*c^2*((m - 1)/ 
(b*(m + 2*p + 1)))   Int[(c*x)^(m - 2)*(a + b*x^2)^p, x], x] /; FreeQ[{a, b 
, c, p}, x] && GtQ[m, 2 - 1] && NeQ[m + 2*p + 1, 0] && IntBinomialQ[a, b, c 
, 2, m, p, x]
 

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

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 = 0.54 (sec) , antiderivative size = 37, normalized size of antiderivative = 1.16

method result size
parts \(\frac {a \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {b \tan \left (f x +e \right )^{3}}{3 f}\) \(37\)
derivativedivides \(\frac {a \left (\tan \left (f x +e \right )-f x -e \right )+\frac {b \sin \left (f x +e \right )^{3}}{3 \cos \left (f x +e \right )^{3}}}{f}\) \(41\)
default \(\frac {a \left (\tan \left (f x +e \right )-f x -e \right )+\frac {b \sin \left (f x +e \right )^{3}}{3 \cos \left (f x +e \right )^{3}}}{f}\) \(41\)
risch \(-a x -\frac {2 i \left (-3 a \,{\mathrm e}^{4 i \left (f x +e \right )}+3 b \,{\mathrm e}^{4 i \left (f x +e \right )}-6 a \,{\mathrm e}^{2 i \left (f x +e \right )}-3 a +b \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}\) \(66\)

Input:

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

Output:

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

Fricas [A] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 53, normalized size of antiderivative = 1.66 \[ \int \left (a+b \sec ^2(e+f x)\right ) \tan ^2(e+f x) \, dx=-\frac {3 \, a f x \cos \left (f x + e\right )^{3} - {\left ({\left (3 \, a - b\right )} \cos \left (f x + e\right )^{2} + b\right )} \sin \left (f x + e\right )}{3 \, f \cos \left (f x + e\right )^{3}} \] Input:

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

Output:

-1/3*(3*a*f*x*cos(f*x + e)^3 - ((3*a - b)*cos(f*x + e)^2 + b)*sin(f*x + e) 
)/(f*cos(f*x + e)^3)
 

Sympy [A] (verification not implemented)

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

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

Output:

a*Piecewise((-x + tan(e + f*x)/f, Ne(f, 0)), (x*tan(e)**2, True)) + b*Piec 
ewise((x*tan(e)**2*sec(e)**2, Eq(f, 0)), (tan(e + f*x)**3/(3*f), True))
 

Maxima [A] (verification not implemented)

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

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

Output:

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

Giac [A] (verification not implemented)

Time = 0.23 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.34 \[ \int \left (a+b \sec ^2(e+f x)\right ) \tan ^2(e+f x) \, dx=-\frac {{\left (f x + e\right )} a}{f} + \frac {b f^{2} \tan \left (f x + e\right )^{3} + 3 \, a f^{2} \tan \left (f x + e\right )}{3 \, f^{3}} \] Input:

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

Output:

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

Mupad [B] (verification not implemented)

Time = 15.49 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.91 \[ \int \left (a+b \sec ^2(e+f x)\right ) \tan ^2(e+f x) \, dx=\frac {\frac {b\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3}+a\,\mathrm {tan}\left (e+f\,x\right )-a\,f\,x}{f} \] Input:

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

Output:

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

Reduce [B] (verification not implemented)

Time = 0.15 (sec) , antiderivative size = 105, normalized size of antiderivative = 3.28 \[ \int \left (a+b \sec ^2(e+f x)\right ) \tan ^2(e+f x) \, dx=\frac {3 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} \tan \left (f x +e \right ) a -3 \cos \left (f x +e \right ) \sin \left (f x +e \right )^{2} a f x -3 \cos \left (f x +e \right ) \tan \left (f x +e \right ) a +3 \cos \left (f x +e \right ) a f x -\sin \left (f x +e \right )^{3} b}{3 \cos \left (f x +e \right ) f \left (\sin \left (f x +e \right )^{2}-1\right )} \] Input:

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

Output:

(3*cos(e + f*x)*sin(e + f*x)**2*tan(e + f*x)*a - 3*cos(e + f*x)*sin(e + f* 
x)**2*a*f*x - 3*cos(e + f*x)*tan(e + f*x)*a + 3*cos(e + f*x)*a*f*x - sin(e 
 + f*x)**3*b)/(3*cos(e + f*x)*f*(sin(e + f*x)**2 - 1))