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

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

Optimal result

Integrand size = 9, antiderivative size = 4 \[ \int \frac {1}{-\cos (x)+\sec (x)} \, dx=-\csc (x) \]

[Out]

-csc(x)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 4, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {4482, 2686, 8} \[ \int \frac {1}{-\cos (x)+\sec (x)} \, dx=-\csc (x) \]

[In]

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

[Out]

-Csc[x]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2686

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

Rule 4482

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rubi steps \begin{align*} \text {integral}& = \int \cot (x) \csc (x) \, dx \\ & = -\text {Subst}(\int 1 \, dx,x,\csc (x)) \\ & = -\csc (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 4, normalized size of antiderivative = 1.00 \[ \int \frac {1}{-\cos (x)+\sec (x)} \, dx=-\csc (x) \]

[In]

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

[Out]

-Csc[x]

Maple [A] (verified)

Time = 0.40 (sec) , antiderivative size = 5, normalized size of antiderivative = 1.25

method result size
parallelrisch \(-\csc \left (x \right )\) \(5\)
default \(-\frac {1}{\sin \left (x \right )}\) \(7\)
norman \(\frac {-\frac {1}{2}-\frac {\tan \left (\frac {x}{2}\right )^{2}}{2}}{\tan \left (\frac {x}{2}\right )}\) \(18\)
risch \(-\frac {2 i {\mathrm e}^{i x}}{{\mathrm e}^{2 i x}-1}\) \(18\)

[In]

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

[Out]

-csc(x)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.50 \[ \int \frac {1}{-\cos (x)+\sec (x)} \, dx=-\frac {1}{\sin \left (x\right )} \]

[In]

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

[Out]

-1/sin(x)

Sympy [F]

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

[In]

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

[Out]

-Integral(1/(cos(x) - sec(x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 21 vs. \(2 (4) = 8\).

Time = 0.21 (sec) , antiderivative size = 21, normalized size of antiderivative = 5.25 \[ \int \frac {1}{-\cos (x)+\sec (x)} \, dx=-\frac {\cos \left (x\right ) + 1}{2 \, \sin \left (x\right )} - \frac {\sin \left (x\right )}{2 \, {\left (\cos \left (x\right ) + 1\right )}} \]

[In]

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

[Out]

-1/2*(cos(x) + 1)/sin(x) - 1/2*sin(x)/(cos(x) + 1)

Giac [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.50 \[ \int \frac {1}{-\cos (x)+\sec (x)} \, dx=-\frac {1}{\sin \left (x\right )} \]

[In]

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

[Out]

-1/sin(x)

Mupad [B] (verification not implemented)

Time = 25.78 (sec) , antiderivative size = 6, normalized size of antiderivative = 1.50 \[ \int \frac {1}{-\cos (x)+\sec (x)} \, dx=-\frac {1}{\sin \left (x\right )} \]

[In]

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

[Out]

-1/sin(x)