3.306 \(\int (\csc (x)-\sin (x)) \, dx\)

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

[Out]

-ArcTanh[Cos[x]] + Cos[x]

________________________________________________________________________________________

Rubi [A]  time = 0.0054189, 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 = {3770, 2638} \[ \cos (x)-\tanh ^{-1}(\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[Csc[x] - Sin[x],x]

[Out]

-ArcTanh[Cos[x]] + Cos[x]

Rule 3770

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

Rule 2638

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

Rubi steps

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

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

Antiderivative was successfully verified.

[In]

Integrate[Csc[x] - Sin[x],x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.003, size = 12, normalized size = 1.5 \begin{align*} \cos \left ( x \right ) -\ln \left ( \cot \left ( x \right ) +\csc \left ( x \right ) \right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(x)-sin(x),x)

[Out]

cos(x)-ln(cot(x)+csc(x))

________________________________________________________________________________________

Maxima [A]  time = 0.985122, size = 15, normalized size = 1.88 \begin{align*} \cos \left (x\right ) - \log \left (\cot \left (x\right ) + \csc \left (x\right )\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)-sin(x),x, algorithm="maxima")

[Out]

cos(x) - log(cot(x) + csc(x))

________________________________________________________________________________________

Fricas [B]  time = 2.15031, size = 88, normalized size = 11. \begin{align*} \cos \left (x\right ) - \frac{1}{2} \, \log \left (\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) + \frac{1}{2} \, \log \left (-\frac{1}{2} \, \cos \left (x\right ) + \frac{1}{2}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)-sin(x),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)-sin(x),x)

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.14856, size = 12, normalized size = 1.5 \begin{align*} \cos \left (x\right ) + \log \left ({\left | \tan \left (\frac{1}{2} \, x\right ) \right |}\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(x)-sin(x),x, algorithm="giac")

[Out]

cos(x) + log(abs(tan(1/2*x)))