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.00, antiderivative size = 8, normalized size of antiderivative = 1.00, 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.00, 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]

________________________________________________________________________________________

fricas [B]  time = 0.95, size = 21, normalized size = 2.62 \[ \frac {1}{2} \, \log \left (\sin \relax (x) + 1\right ) - \frac {1}{2} \, \log \left (-\sin \relax (x) + 1\right ) - \sin \relax (x) \]

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)

________________________________________________________________________________________

giac [B]  time = 0.15, size = 29, normalized size = 3.62 \[ \frac {1}{4} \, \log \left ({\left | \frac {1}{\sin \relax (x)} + \sin \relax (x) + 2 \right |}\right ) - \frac {1}{4} \, \log \left ({\left | \frac {1}{\sin \relax (x)} + \sin \relax (x) - 2 \right |}\right ) - \sin \relax (x) \]

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)

________________________________________________________________________________________

maple [A]  time = 0.00, size = 12, normalized size = 1.50 \[ -\sin \relax (x )+\ln \left (\sec \relax (x )+\tan \relax (x )\right ) \]

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.32, size = 11, normalized size = 1.38 \[ \log \left (\sec \relax (x) + \tan \relax (x)\right ) - \sin \relax (x) \]

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)

________________________________________________________________________________________

mupad [B]  time = 2.30, size = 14, normalized size = 1.75 \[ \ln \left (\mathrm {tan}\left (\frac {x}{2}+\frac {\pi }{4}\right )\right )-\sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

log(tan(x/2 + pi/4)) - sin(x)

________________________________________________________________________________________

sympy [B]  time = 0.09, size = 19, normalized size = 2.38 \[ - \frac {\log {\left (\sin {\relax (x )} - 1 \right )}}{2} + \frac {\log {\left (\sin {\relax (x )} + 1 \right )}}{2} - \sin {\relax (x )} \]

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)

________________________________________________________________________________________