\(\int (-\cos (x)+\sec (x)) \, dx\) [325]

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

Optimal result

Integrand size = 7, antiderivative size = 8 \[ \int (-\cos (x)+\sec (x)) \, dx=\text {arctanh}(\sin (x))-\sin (x) \]

[Out]

arctanh(sin(x))-sin(x)

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {2717, 3855} \[ \int (-\cos (x)+\sec (x)) \, dx=\text {arctanh}(\sin (x))-\sin (x) \]

[In]

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

[Out]

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

Rule 2717

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

Rule 3855

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

Rubi steps \begin{align*} \text {integral}& = -\int \cos (x) \, dx+\int \sec (x) \, dx \\ & = \text {arctanh}(\sin (x))-\sin (x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 8, normalized size of antiderivative = 1.00 \[ \int (-\cos (x)+\sec (x)) \, dx=\text {arctanh}(\sin (x))-\sin (x) \]

[In]

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

[Out]

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

Maple [A] (verified)

Time = 0.22 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.50

method result size
default \(-\sin \left (x \right )+\ln \left (\sec \left (x \right )+\tan \left (x \right )\right )\) \(12\)
parts \(-\sin \left (x \right )+\ln \left (\sec \left (x \right )+\tan \left (x \right )\right )\) \(12\)
parallelrisch \(-\sin \left (x \right )-\ln \left (-\cot \left (x \right )+\csc \left (x \right )-1\right )+\ln \left (\csc \left (x \right )-\cot \left (x \right )+1\right )\) \(26\)
norman \(-\frac {2 \tan \left (\frac {x}{2}\right )}{1+\tan \left (\frac {x}{2}\right )^{2}}-\ln \left (\tan \left (\frac {x}{2}\right )-1\right )+\ln \left (\tan \left (\frac {x}{2}\right )+1\right )\) \(34\)
risch \(\frac {i {\mathrm e}^{i x}}{2}-\frac {i {\mathrm e}^{-i x}}{2}+\ln \left (i+{\mathrm e}^{i x}\right )-\ln \left ({\mathrm e}^{i x}-i\right )\) \(38\)

[In]

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

[Out]

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

Fricas [B] (verification not implemented)

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

Time = 0.24 (sec) , antiderivative size = 21, normalized size of antiderivative = 2.62 \[ \int (-\cos (x)+\sec (x)) \, dx=\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 ) \]

[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] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 19 vs. \(2 (7) = 14\).

Time = 0.05 (sec) , antiderivative size = 19, normalized size of antiderivative = 2.38 \[ \int (-\cos (x)+\sec (x)) \, dx=- \frac {\log {\left (\sin {\left (x \right )} - 1 \right )}}{2} + \frac {\log {\left (\sin {\left (x \right )} + 1 \right )}}{2} - \sin {\left (x \right )} \]

[In]

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

[Out]

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

Maxima [A] (verification not implemented)

none

Time = 0.22 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.38 \[ \int (-\cos (x)+\sec (x)) \, dx=\log \left (\sec \left (x\right ) + \tan \left (x\right )\right ) - \sin \left (x\right ) \]

[In]

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

[Out]

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

Giac [B] (verification not implemented)

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

Time = 0.26 (sec) , antiderivative size = 29, normalized size of antiderivative = 3.62 \[ \int (-\cos (x)+\sec (x)) \, dx=\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 ) \]

[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)

Mupad [B] (verification not implemented)

Time = 27.76 (sec) , antiderivative size = 14, normalized size of antiderivative = 1.75 \[ \int (-\cos (x)+\sec (x)) \, dx=\ln \left (\mathrm {tan}\left (\frac {x}{2}+\frac {\pi }{4}\right )\right )-\sin \left (x\right ) \]

[In]

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

[Out]

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