3.297 \(\int (\cot (x)+\csc (x)) \, dx\)

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

[Out]

-ArcTanh[Cos[x]] + Log[Sin[x]]

________________________________________________________________________________________

Rubi [A]  time = 0.0053846, antiderivative size = 9, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 5, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.4, Rules used = {3475, 3770} \[ \log (\sin (x))-\tanh ^{-1}(\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[Cot[x] + Csc[x],x]

[Out]

-ArcTanh[Cos[x]] + Log[Sin[x]]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], 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 (\cot (x)+\csc (x)) \, dx &=\int \cot (x) \, dx+\int \csc (x) \, dx\\ &=-\tanh ^{-1}(\cos (x))+\log (\sin (x))\\ \end{align*}

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

Antiderivative was successfully verified.

[In]

Integrate[Cot[x] + Csc[x],x]

[Out]

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

________________________________________________________________________________________

Maple [A]  time = 0.003, size = 13, normalized size = 1.4 \begin{align*} \ln \left ( \sin \left ( x \right ) \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(cot(x)+csc(x),x)

[Out]

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

________________________________________________________________________________________

Maxima [A]  time = 1.0108, size = 16, normalized size = 1.78 \begin{align*} -\log \left (\cot \left (x\right ) + \csc \left (x\right )\right ) + \log \left (\sin \left (x\right )\right ) \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(x)+csc(x),x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 2.07307, size = 32, normalized size = 3.56 \begin{align*} \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(cot(x)+csc(x),x, algorithm="fricas")

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(x)+csc(x),x)

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.17512, size = 24, normalized size = 2.67 \begin{align*} \frac{1}{2} \, \log \left (-\cos \left (x\right )^{2} + 1\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(cot(x)+csc(x),x, algorithm="giac")

[Out]

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