Optimal. Leaf size=62 \[ \frac {x}{4}+\frac {i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\frac {1}{2} i \text {Li}_2\left (-e^{2 i x}\right )-\frac {1}{4} \cos (x) \sin (x)-\frac {1}{2} x \sin ^2(x) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.05, antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 8, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 1.000, Rules used = {4492, 3524,
2715, 8, 3800, 2221, 2317, 2438} \begin {gather*} \frac {1}{2} i \text {PolyLog}\left (2,-e^{2 i x}\right )+\frac {i x^2}{2}+\frac {x}{4}-x \log \left (1+e^{2 i x}\right )-\frac {1}{2} x \sin ^2(x)-\frac {1}{4} \sin (x) \cos (x) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2221
Rule 2317
Rule 2438
Rule 2715
Rule 3524
Rule 3800
Rule 4492
Rubi steps
\begin {align*} \int x \sin ^2(x) \tan (x) \, dx &=-\int x \cos (x) \sin (x) \, dx+\int x \tan (x) \, dx\\ &=\frac {i x^2}{2}-\frac {1}{2} x \sin ^2(x)-2 i \int \frac {e^{2 i x} x}{1+e^{2 i x}} \, dx+\frac {1}{2} \int \sin ^2(x) \, dx\\ &=\frac {i x^2}{2}-x \log \left (1+e^{2 i x}\right )-\frac {1}{4} \cos (x) \sin (x)-\frac {1}{2} x \sin ^2(x)+\frac {\int 1 \, dx}{4}+\int \log \left (1+e^{2 i x}\right ) \, dx\\ &=\frac {x}{4}+\frac {i x^2}{2}-x \log \left (1+e^{2 i x}\right )-\frac {1}{4} \cos (x) \sin (x)-\frac {1}{2} x \sin ^2(x)-\frac {1}{2} i \text {Subst}\left (\int \frac {\log (1+x)}{x} \, dx,x,e^{2 i x}\right )\\ &=\frac {x}{4}+\frac {i x^2}{2}-x \log \left (1+e^{2 i x}\right )+\frac {1}{2} i \text {Li}_2\left (-e^{2 i x}\right )-\frac {1}{4} \cos (x) \sin (x)-\frac {1}{2} x \sin ^2(x)\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.01, size = 57, normalized size = 0.92 \begin {gather*} \frac {i x^2}{2}+\frac {1}{4} x \cos (2 x)-x \log \left (1+e^{2 i x}\right )+\frac {1}{2} i \text {Li}_2\left (-e^{2 i x}\right )-\frac {1}{8} \sin (2 x) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.08, size = 57, normalized size = 0.92
method | result | size |
risch | \(\frac {i x^{2}}{2}+\frac {\left (i+2 x \right ) {\mathrm e}^{2 i x}}{16}+\frac {\left (-i+2 x \right ) {\mathrm e}^{-2 i x}}{16}-x \ln \left ({\mathrm e}^{2 i x}+1\right )+\frac {i \polylog \left (2, -{\mathrm e}^{2 i x}\right )}{2}\) | \(57\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 1.05, size = 66, normalized size = 1.06 \begin {gather*} \frac {1}{2} i \, x^{2} - i \, x \arctan \left (\sin \left (2 \, x\right ), \cos \left (2 \, x\right ) + 1\right ) + \frac {1}{4} \, x \cos \left (2 \, x\right ) - \frac {1}{2} \, x \log \left (\cos \left (2 \, x\right )^{2} + \sin \left (2 \, x\right )^{2} + 2 \, \cos \left (2 \, x\right ) + 1\right ) + \frac {1}{2} i \, {\rm Li}_2\left (-e^{\left (2 i \, x\right )}\right ) - \frac {1}{8} \, \sin \left (2 \, x\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 113 vs. \(2 (41) = 82\).
time = 1.02, size = 113, normalized size = 1.82 \begin {gather*} \frac {1}{2} \, x \cos \left (x\right )^{2} - \frac {1}{2} \, x \log \left (i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) - \frac {1}{2} \, x \log \left (i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) - \frac {1}{2} \, x \log \left (-i \, \cos \left (x\right ) + \sin \left (x\right ) + 1\right ) - \frac {1}{2} \, x \log \left (-i \, \cos \left (x\right ) - \sin \left (x\right ) + 1\right ) - \frac {1}{4} \, \cos \left (x\right ) \sin \left (x\right ) - \frac {1}{4} \, x - \frac {1}{2} i \, {\rm Li}_2\left (i \, \cos \left (x\right ) + \sin \left (x\right )\right ) + \frac {1}{2} i \, {\rm Li}_2\left (i \, \cos \left (x\right ) - \sin \left (x\right )\right ) + \frac {1}{2} i \, {\rm Li}_2\left (-i \, \cos \left (x\right ) + \sin \left (x\right )\right ) - \frac {1}{2} i \, {\rm Li}_2\left (-i \, \cos \left (x\right ) - \sin \left (x\right )\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {x \sin ^{3}{\left (x \right )}}{\cos {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.02 \begin {gather*} \int \frac {x\,{\sin \left (x\right )}^3}{\cos \left (x\right )} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________