Optimal. Leaf size=20 \[ -\cot (x)+\frac {x \csc (x)}{x \cos (x)-\sin (x)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.02, antiderivative size = 20, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 15, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {4690, 3852, 8}
\begin {gather*} \frac {x \csc (x)}{x \cos (x)-\sin (x)}-\cot (x) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 4690
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)}-\text {Subst}(\int 1 \, dx,x,\cot (x))\\ &=-\cot (x)+\frac {x \csc (x)}{x \cos (x)-\sin (x)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.09, size = 19, normalized size = 0.95 \begin {gather*} \frac {\cos (x)+x \sin (x)}{x \cos (x)-\sin (x)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [C] Result contains complex when optimal does not.
time = 0.25, size = 29, normalized size = 1.45
method | result | size |
risch | \(\frac {2 i \left (x -i\right )}{i {\mathrm e}^{2 i x}+x \,{\mathrm e}^{2 i x}-i+x}\) | \(29\) |
norman | \(\frac {-1+\tan ^{2}\left (\frac {x}{2}\right )-2 x \tan \left (\frac {x}{2}\right )}{x \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-x +2 \tan \left (\frac {x}{2}\right )}\) | \(37\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 69 vs.
\(2 (20) = 40\).
time = 5.02, size = 69, normalized size = 3.45 \begin {gather*} \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 {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.82, size = 19, normalized size = 0.95 \begin {gather*} \frac {x \sin \left (x\right ) + \cos \left (x\right )}{x \cos \left (x\right ) - \sin \left (x\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 66 vs.
\(2 (15) = 30\).
time = 0.67, size = 66, normalized size = 3.30 \begin {gather*} - \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 {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.31, size = 39, normalized size = 1.95 \begin {gather*} -\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 {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.05 \begin {gather*} \int \frac {x^2}{{\left (\sin \left (x\right )-x\,\cos \left (x\right )\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________