3.325 \(\int (-\cos (x)+\sec (x)) \, dx\)

Optimal. Leaf size=8 \[ \tanh ^{-1}(\sin (x))-\sin (x) \]

[Out]

ArcTanh[Sin[x]] - Sin[x]

________________________________________________________________________________________

Rubi [A]  time = 0.004773, antiderivative size = 8, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 7, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.286, Rules used = {2637, 3770} \[ \tanh ^{-1}(\sin (x))-\sin (x) \]

Antiderivative was successfully verified.

[In]

Int[-Cos[x] + Sec[x],x]

[Out]

ArcTanh[Sin[x]] - Sin[x]

Rule 2637

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3770

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (-\cos (x)+\sec (x)) \, dx &=-\int \cos (x) \, dx+\int \sec (x) \, dx\\ &=\tanh ^{-1}(\sin (x))-\sin (x)\\ \end{align*}

Mathematica [B]  time = 0.0042199, size = 37, normalized size = 4.62 \[ -\sin (x)-\log \left (\cos \left (\frac{x}{2}\right )-\sin \left (\frac{x}{2}\right )\right )+\log \left (\sin \left (\frac{x}{2}\right )+\cos \left (\frac{x}{2}\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[-Cos[x] + Sec[x],x]

[Out]

-Log[Cos[x/2] - Sin[x/2]] + Log[Cos[x/2] + Sin[x/2]] - Sin[x]

________________________________________________________________________________________

Maple [A]  time = 0.002, size = 12, normalized size = 1.5 \begin{align*} -\sin \left ( x \right ) +\ln \left ( \sec \left ( x \right ) +\tan \left ( x \right ) \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(-cos(x)+sec(x),x)

[Out]

-sin(x)+ln(sec(x)+tan(x))

________________________________________________________________________________________

Maxima [A]  time = 0.995348, size = 15, normalized size = 1.88 \begin{align*} \log \left (\sec \left (x\right ) + \tan \left (x\right )\right ) - \sin \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(sec(x) + tan(x)) - sin(x)

________________________________________________________________________________________

Fricas [B]  time = 2.11805, size = 72, normalized size = 9. \begin{align*} \frac{1}{2} \, \log \left (\sin \left (x\right ) + 1\right ) - \frac{1}{2} \, \log \left (-\sin \left (x\right ) + 1\right ) - \sin \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [B]  time = 0.110682, size = 19, normalized size = 2.38 \begin{align*} - \frac{\log{\left (\sin{\left (x \right )} - 1 \right )}}{2} + \frac{\log{\left (\sin{\left (x \right )} + 1 \right )}}{2} - \sin{\left (x \right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-log(sin(x) - 1)/2 + log(sin(x) + 1)/2 - sin(x)

________________________________________________________________________________________

Giac [B]  time = 1.14779, size = 39, normalized size = 4.88 \begin{align*} \frac{1}{4} \, \log \left ({\left | \frac{1}{\sin \left (x\right )} + \sin \left (x\right ) + 2 \right |}\right ) - \frac{1}{4} \, \log \left ({\left | \frac{1}{\sin \left (x\right )} + \sin \left (x\right ) - 2 \right |}\right ) - \sin \left (x\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/4*log(abs(1/sin(x) + sin(x) + 2)) - 1/4*log(abs(1/sin(x) + sin(x) - 2)) - sin(x)