3.493 \(\int \frac{x^2}{(x \cos (x)-\sin (x))^2} \, dx\)

Optimal. Leaf size=20 \[ \frac{x \csc (x)}{x \cos (x)-\sin (x)}-\cot (x) \]

[Out]

-Cot[x] + (x*Csc[x])/(x*Cos[x] - Sin[x])

________________________________________________________________________________________

Rubi [A]  time = 0.0341266, antiderivative size = 20, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 15, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.2, Rules used = {4594, 3767, 8} \[ \frac{x \csc (x)}{x \cos (x)-\sin (x)}-\cot (x) \]

Antiderivative was successfully verified.

[In]

Int[x^2/(x*Cos[x] - Sin[x])^2,x]

[Out]

-Cot[x] + (x*Csc[x])/(x*Cos[x] - Sin[x])

Rule 4594

Int[(x_)^2/(Cos[(a_.)*(x_)]*(d_.)*(x_) + (c_.)*Sin[(a_.)*(x_)])^2, x_Symbol] :> Simp[x/(a*d*Sin[a*x]*(c*Sin[a*
x] + d*x*Cos[a*x])), x] + Dist[1/d^2, Int[1/Sin[a*x]^2, x], x] /; FreeQ[{a, c, d}, x] && EqQ[a*c + d, 0]

Rule 3767

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \frac{x^2}{(x \cos (x)-\sin (x))^2} \, dx &=\frac{x \csc (x)}{x \cos (x)-\sin (x)}+\int \csc ^2(x) \, dx\\ &=\frac{x \csc (x)}{x \cos (x)-\sin (x)}-\operatorname{Subst}(\int 1 \, dx,x,\cot (x))\\ &=-\cot (x)+\frac{x \csc (x)}{x \cos (x)-\sin (x)}\\ \end{align*}

Mathematica [A]  time = 0.207802, size = 19, normalized size = 0.95 \[ \frac{x \sin (x)+\cos (x)}{x \cos (x)-\sin (x)} \]

Antiderivative was successfully verified.

[In]

Integrate[x^2/(x*Cos[x] - Sin[x])^2,x]

[Out]

(Cos[x] + x*Sin[x])/(x*Cos[x] - Sin[x])

________________________________________________________________________________________

Maple [A]  time = 0.214, size = 37, normalized size = 1.9 \begin{align*}{ \left ( -1+ \left ( \tan \left ({\frac{x}{2}} \right ) \right ) ^{2}-2\,x\tan \left ( x/2 \right ) \right ) \left ( x \left ( \tan \left ({\frac{x}{2}} \right ) \right ) ^{2}-x+2\,\tan \left ( x/2 \right ) \right ) ^{-1}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2/(x*cos(x)-sin(x))^2,x)

[Out]

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

________________________________________________________________________________________

Maxima [B]  time = 0.954805, size = 93, normalized size = 4.65 \begin{align*} \frac{2 \,{\left (2 \, x \cos \left (2 \, x\right ) +{\left (x^{2} - 1\right )} \sin \left (2 \, x\right )\right )}}{{\left (x^{2} + 1\right )} \cos \left (2 \, x\right )^{2} +{\left (x^{2} + 1\right )} \sin \left (2 \, x\right )^{2} + x^{2} + 2 \,{\left (x^{2} - 1\right )} \cos \left (2 \, x\right ) - 4 \, x \sin \left (2 \, x\right ) + 1} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2/(x*cos(x)-sin(x))^2,x, algorithm="maxima")

[Out]

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

________________________________________________________________________________________

Fricas [A]  time = 1.82124, size = 55, normalized size = 2.75 \begin{align*} \frac{x \sin \left (x\right ) + \cos \left (x\right )}{x \cos \left (x\right ) - \sin \left (x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2/(x*cos(x)-sin(x))^2,x, algorithm="fricas")

[Out]

(x*sin(x) + cos(x))/(x*cos(x) - sin(x))

________________________________________________________________________________________

Sympy [B]  time = 2.35619, size = 66, normalized size = 3.3 \begin{align*} - \frac{2 x \tan{\left (\frac{x}{2} \right )}}{x \tan ^{2}{\left (\frac{x}{2} \right )} - x + 2 \tan{\left (\frac{x}{2} \right )}} + \frac{\tan ^{2}{\left (\frac{x}{2} \right )}}{x \tan ^{2}{\left (\frac{x}{2} \right )} - x + 2 \tan{\left (\frac{x}{2} \right )}} - \frac{1}{x \tan ^{2}{\left (\frac{x}{2} \right )} - x + 2 \tan{\left (\frac{x}{2} \right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**2/(x*cos(x)-sin(x))**2,x)

[Out]

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

________________________________________________________________________________________

Giac [A]  time = 1.06728, size = 53, normalized size = 2.65 \begin{align*} -\frac{2 \, x \tan \left (\frac{1}{2} \, x\right ) - \tan \left (\frac{1}{2} \, x\right )^{2} + 1}{x \tan \left (\frac{1}{2} \, x\right )^{2} - x + 2 \, \tan \left (\frac{1}{2} \, x\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2/(x*cos(x)-sin(x))^2,x, algorithm="giac")

[Out]

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