\(\int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx\) [329]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (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)

Optimal result

Integrand size = 9, antiderivative size = 17 \[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=-\frac {1}{5} \cot ^5(x)-\frac {\cot ^7(x)}{7} \]

[Out]

-1/5*cot(x)^5-1/7*cot(x)^7

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 0, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.000, Rules used = {} \[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=-\frac {1}{7} \cot ^7(x)-\frac {\cot ^5(x)}{5} \]

[In]

Int[(-Cos[x] + Sec[x])^(-4),x]

[Out]

-1/5*Cot[x]^5 - Cot[x]^7/7

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

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(37\) vs. \(2(17)=34\).

Time = 0.03 (sec) , antiderivative size = 37, normalized size of antiderivative = 2.18 \[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=-\frac {2 \cot (x)}{35}-\frac {1}{35} \cot (x) \csc ^2(x)+\frac {8}{35} \cot (x) \csc ^4(x)-\frac {1}{7} \cot (x) \csc ^6(x) \]

[In]

Integrate[(-Cos[x] + Sec[x])^(-4),x]

[Out]

(-2*Cot[x])/35 - (Cot[x]*Csc[x]^2)/35 + (8*Cot[x]*Csc[x]^4)/35 - (Cot[x]*Csc[x]^6)/7

Maple [A] (verified)

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

method result size
default \(-\frac {1}{5 \tan \left (x \right )^{5}}-\frac {1}{7 \tan \left (x \right )^{7}}\) \(14\)
parallelrisch \(\frac {2 \cot \left (x \right )^{7}}{35}-\frac {\cot \left (x \right )^{5} \csc \left (x \right )^{2}}{5}\) \(18\)
risch \(\frac {4 i \left (35 \,{\mathrm e}^{10 i x}+35 \,{\mathrm e}^{8 i x}+70 \,{\mathrm e}^{6 i x}+14 \,{\mathrm e}^{4 i x}+7 \,{\mathrm e}^{2 i x}-1\right )}{35 \left ({\mathrm e}^{2 i x}-1\right )^{7}}\) \(50\)
norman \(\frac {-\frac {1}{896}+\frac {\tan \left (\frac {x}{2}\right )^{2}}{640}+\frac {\tan \left (\frac {x}{2}\right )^{4}}{128}-\frac {3 \tan \left (\frac {x}{2}\right )^{6}}{128}+\frac {3 \tan \left (\frac {x}{2}\right )^{8}}{128}-\frac {\tan \left (\frac {x}{2}\right )^{10}}{128}-\frac {\tan \left (\frac {x}{2}\right )^{12}}{640}+\frac {\tan \left (\frac {x}{2}\right )^{14}}{896}}{\tan \left (\frac {x}{2}\right )^{7}}\) \(66\)

[In]

int(1/(-cos(x)+sec(x))^4,x,method=_RETURNVERBOSE)

[Out]

-1/5/tan(x)^5-1/7/tan(x)^7

Fricas [B] (verification not implemented)

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

Time = 0.25 (sec) , antiderivative size = 39, normalized size of antiderivative = 2.29 \[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=-\frac {2 \, \cos \left (x\right )^{7} - 7 \, \cos \left (x\right )^{5}}{35 \, {\left (\cos \left (x\right )^{6} - 3 \, \cos \left (x\right )^{4} + 3 \, \cos \left (x\right )^{2} - 1\right )} \sin \left (x\right )} \]

[In]

integrate(1/(-cos(x)+sec(x))^4,x, algorithm="fricas")

[Out]

-1/35*(2*cos(x)^7 - 7*cos(x)^5)/((cos(x)^6 - 3*cos(x)^4 + 3*cos(x)^2 - 1)*sin(x))

Sympy [F]

\[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=\int \frac {1}{\left (- \cos {\left (x \right )} + \sec {\left (x \right )}\right )^{4}}\, dx \]

[In]

integrate(1/(-cos(x)+sec(x))**4,x)

[Out]

Integral((-cos(x) + sec(x))**(-4), x)

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.82 \[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=-\frac {7 \, \tan \left (x\right )^{2} + 5}{35 \, \tan \left (x\right )^{7}} \]

[In]

integrate(1/(-cos(x)+sec(x))^4,x, algorithm="maxima")

[Out]

-1/35*(7*tan(x)^2 + 5)/tan(x)^7

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 14, normalized size of antiderivative = 0.82 \[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=-\frac {7 \, \tan \left (x\right )^{2} + 5}{35 \, \tan \left (x\right )^{7}} \]

[In]

integrate(1/(-cos(x)+sec(x))^4,x, algorithm="giac")

[Out]

-1/35*(7*tan(x)^2 + 5)/tan(x)^7

Mupad [B] (verification not implemented)

Time = 28.09 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.94 \[ \int \frac {1}{(-\cos (x)+\sec (x))^4} \, dx=\frac {{\cos \left (x\right )}^5\,\left (\cos \left (2\,x\right )-6\right )}{35\,{\sin \left (x\right )}^7} \]

[In]

int(1/(cos(x) - 1/cos(x))^4,x)

[Out]

(cos(x)^5*(cos(2*x) - 6))/(35*sin(x)^7)