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

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

[Out]

-arctanh(cos(x))+ln(sin(x))

________________________________________________________________________________________

Rubi [A]  time = 0.01, antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.400, 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.00, 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]]

________________________________________________________________________________________

fricas [A]  time = 1.03, size = 7, normalized size = 0.78 \[ \log \left (-\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) \]

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)

________________________________________________________________________________________

giac [A]  time = 0.15, size = 11, normalized size = 1.22 \[ \log \left ({\left | \sin \relax (x) \right |}\right ) + \log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) \right |}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.00, size = 13, normalized size = 1.44 \[ \ln \left (\sin \relax (x )\right )-\ln \left (\cot \relax (x )+\csc \relax (x )\right ) \]

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 = 0.30, size = 12, normalized size = 1.33 \[ -\log \left (\cot \relax (x) + \csc \relax (x)\right ) + \log \left (\sin \relax (x)\right ) \]

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

________________________________________________________________________________________

mupad [B]  time = 2.41, size = 19, normalized size = 2.11 \[ 2\,\ln \left (\mathrm {tan}\left (\frac {x}{2}\right )\right )-\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(x) + 1/sin(x),x)

[Out]

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

________________________________________________________________________________________

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

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

________________________________________________________________________________________