\(\int x \csc ^2(x) \, dx\) [41]

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

Optimal result

Integrand size = 6, antiderivative size = 9 \[ \int x \csc ^2(x) \, dx=-x \cot (x)+\log (\sin (x)) \]

[Out]

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

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {4269, 3556} \[ \int x \csc ^2(x) \, dx=\log (\sin (x))-x \cot (x) \]

[In]

Int[x*Csc[x]^2,x]

[Out]

-(x*Cot[x]) + Log[Sin[x]]

Rule 3556

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

Rule 4269

Int[csc[(e_.) + (f_.)*(x_)]^2*((c_.) + (d_.)*(x_))^(m_.), x_Symbol] :> Simp[(-(c + d*x)^m)*(Cot[e + f*x]/f), x
] + Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cot[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

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

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00 \[ \int x \csc ^2(x) \, dx=-x \cot (x)+\log (\sin (x)) \]

[In]

Integrate[x*Csc[x]^2,x]

[Out]

-(x*Cot[x]) + Log[Sin[x]]

Maple [A] (verified)

Time = 0.16 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.11

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

[In]

int(x*csc(x)^2,x,method=_RETURNVERBOSE)

[Out]

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

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 20 vs. \(2 (9) = 18\).

Time = 0.26 (sec) , antiderivative size = 20, normalized size of antiderivative = 2.22 \[ \int x \csc ^2(x) \, dx=-\frac {x \cos \left (x\right ) - \log \left (\frac {1}{2} \, \sin \left (x\right )\right ) \sin \left (x\right )}{\sin \left (x\right )} \]

[In]

integrate(x*csc(x)^2,x, algorithm="fricas")

[Out]

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

Sympy [A] (verification not implemented)

Time = 0.28 (sec) , antiderivative size = 8, normalized size of antiderivative = 0.89 \[ \int x \csc ^2(x) \, dx=- x \cot {\left (x \right )} + \log {\left (\sin {\left (x \right )} \right )} \]

[In]

integrate(x*csc(x)**2,x)

[Out]

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

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 104 vs. \(2 (9) = 18\).

Time = 0.19 (sec) , antiderivative size = 104, normalized size of antiderivative = 11.56 \[ \int x \csc ^2(x) \, dx=\frac {{\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} - 2 \, \cos \left (2 \, x\right ) + 1\right )} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} + 2 \, \cos \left (x\right ) + 1\right ) + {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} - 2 \, \cos \left (2 \, x\right ) + 1\right )} \log \left (\cos \left (x\right )^{2} + \sin \left (x\right )^{2} - 2 \, \cos \left (x\right ) + 1\right ) - 4 \, x \sin \left (2 \, x\right )}{2 \, {\left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} - 2 \, \cos \left (2 \, x\right ) + 1\right )}} \]

[In]

integrate(x*csc(x)^2,x, algorithm="maxima")

[Out]

1/2*((cos(2*x)^2 + sin(2*x)^2 - 2*cos(2*x) + 1)*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) + (cos(2*x)^2 + sin(2*
x)^2 - 2*cos(2*x) + 1)*log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) - 4*x*sin(2*x))/(cos(2*x)^2 + sin(2*x)^2 - 2*co
s(2*x) + 1)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 52 vs. \(2 (9) = 18\).

Time = 0.31 (sec) , antiderivative size = 52, normalized size of antiderivative = 5.78 \[ \int x \csc ^2(x) \, dx=\frac {x \tan \left (\frac {1}{2} \, x\right )^{2} + \log \left (\frac {16 \, \tan \left (\frac {1}{2} \, x\right )^{2}}{\tan \left (\frac {1}{2} \, x\right )^{4} + 2 \, \tan \left (\frac {1}{2} \, x\right )^{2} + 1}\right ) \tan \left (\frac {1}{2} \, x\right ) - x}{2 \, \tan \left (\frac {1}{2} \, x\right )} \]

[In]

integrate(x*csc(x)^2,x, algorithm="giac")

[Out]

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

Mupad [B] (verification not implemented)

Time = 0.16 (sec) , antiderivative size = 9, normalized size of antiderivative = 1.00 \[ \int x \csc ^2(x) \, dx=\ln \left (\sin \left (x\right )\right )-x\,\mathrm {cot}\left (x\right ) \]

[In]

int(x/sin(x)^2,x)

[Out]

log(sin(x)) - x*cot(x)