\(\int \sec ^4(x) (-1+\sec ^2(x))^2 \tan (x) \, dx\) [715]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 17 \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {\tan ^6(x)}{6}+\frac {\tan ^8(x)}{8} \]

[Out]

1/6*tan(x)^6+1/8*tan(x)^8

Rubi [A] (verified)

Time = 0.07 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {4205, 2687, 14} \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {\tan ^8(x)}{8}+\frac {\tan ^6(x)}{6} \]

[In]

Int[Sec[x]^4*(-1 + Sec[x]^2)^2*Tan[x],x]

[Out]

Tan[x]^6/6 + Tan[x]^8/8

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 2687

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[1/f, Subst[Int[(b*x)
^n*(1 + x^2)^(m/2 - 1), x], x, Tan[e + f*x]], x] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2] &&  !(IntegerQ[(n
- 1)/2] && LtQ[0, n, m - 1])

Rule 4205

Int[(u_.)*((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^2)^(p_), x_Symbol] :> Dist[b^p, Int[ActivateTrig[u*tan[e + f*x
]^(2*p)], x], x] /; FreeQ[{a, b, e, f, p}, x] && EqQ[a + b, 0] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \int \sec ^4(x) \tan ^5(x) \, dx \\ & = \text {Subst}\left (\int x^5 \left (1+x^2\right ) \, dx,x,\tan (x)\right ) \\ & = \text {Subst}\left (\int \left (x^5+x^7\right ) \, dx,x,\tan (x)\right ) \\ & = \frac {\tan ^6(x)}{6}+\frac {\tan ^8(x)}{8} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 25, normalized size of antiderivative = 1.47 \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {\sec ^4(x)}{4}-\frac {\sec ^6(x)}{3}+\frac {\sec ^8(x)}{8} \]

[In]

Integrate[Sec[x]^4*(-1 + Sec[x]^2)^2*Tan[x],x]

[Out]

Sec[x]^4/4 - Sec[x]^6/3 + Sec[x]^8/8

Maple [A] (verified)

Time = 19.94 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.82

method result size
derivativedivides \(\frac {\tan \left (x \right )^{6}}{6}+\frac {\tan \left (x \right )^{8}}{8}\) \(14\)
default \(\frac {\tan \left (x \right )^{6}}{6}+\frac {\tan \left (x \right )^{8}}{8}\) \(14\)
parts \(\frac {\sec \left (x \right )^{8}}{8}+\frac {\sec \left (x \right )^{4}}{4}-\frac {\sec \left (x \right )^{6}}{3}\) \(20\)
risch \(\frac {4 \,{\mathrm e}^{12 i x}-\frac {16 \,{\mathrm e}^{10 i x}}{3}+\frac {40 \,{\mathrm e}^{8 i x}}{3}-\frac {16 \,{\mathrm e}^{6 i x}}{3}+4 \,{\mathrm e}^{4 i x}}{\left ({\mathrm e}^{2 i x}+1\right )^{8}}\) \(48\)

[In]

int(sec(x)^4*(-1+sec(x)^2)^2*tan(x),x,method=_RETURNVERBOSE)

[Out]

1/6*tan(x)^6+1/8*tan(x)^8

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.18 \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {6 \, \cos \left (x\right )^{4} - 8 \, \cos \left (x\right )^{2} + 3}{24 \, \cos \left (x\right )^{8}} \]

[In]

integrate(sec(x)^4*(-1+sec(x)^2)^2*tan(x),x, algorithm="fricas")

[Out]

1/24*(6*cos(x)^4 - 8*cos(x)^2 + 3)/cos(x)^8

Sympy [A] (verification not implemented)

Time = 0.91 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.12 \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {\sec ^{8}{\left (x \right )}}{8} - \frac {\sec ^{6}{\left (x \right )}}{3} + \frac {\sec ^{4}{\left (x \right )}}{4} \]

[In]

integrate(sec(x)**4*(-1+sec(x)**2)**2*tan(x),x)

[Out]

sec(x)**8/8 - sec(x)**6/3 + sec(x)**4/4

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 42 vs. \(2 (13) = 26\).

Time = 0.22 (sec) , antiderivative size = 42, normalized size of antiderivative = 2.47 \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {6 \, \sin \left (x\right )^{4} - 4 \, \sin \left (x\right )^{2} + 1}{24 \, {\left (\sin \left (x\right )^{8} - 4 \, \sin \left (x\right )^{6} + 6 \, \sin \left (x\right )^{4} - 4 \, \sin \left (x\right )^{2} + 1\right )}} \]

[In]

integrate(sec(x)^4*(-1+sec(x)^2)^2*tan(x),x, algorithm="maxima")

[Out]

1/24*(6*sin(x)^4 - 4*sin(x)^2 + 1)/(sin(x)^8 - 4*sin(x)^6 + 6*sin(x)^4 - 4*sin(x)^2 + 1)

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 20, normalized size of antiderivative = 1.18 \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {6 \, \cos \left (x\right )^{4} - 8 \, \cos \left (x\right )^{2} + 3}{24 \, \cos \left (x\right )^{8}} \]

[In]

integrate(sec(x)^4*(-1+sec(x)^2)^2*tan(x),x, algorithm="giac")

[Out]

1/24*(6*cos(x)^4 - 8*cos(x)^2 + 3)/cos(x)^8

Mupad [B] (verification not implemented)

Time = 26.29 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.82 \[ \int \sec ^4(x) \left (-1+\sec ^2(x)\right )^2 \tan (x) \, dx=\frac {{\mathrm {tan}\left (x\right )}^6\,\left (3\,{\mathrm {tan}\left (x\right )}^2+4\right )}{24} \]

[In]

int((tan(x)*(1/cos(x)^2 - 1)^2)/cos(x)^4,x)

[Out]

(tan(x)^6*(3*tan(x)^2 + 4))/24