3.1.35 \(\int x^2 \sin ^2(x) \, dx\) [35]

Optimal. Leaf size=41 \[ -\frac {x}{4}+\frac {x^3}{6}+\frac {1}{4} \cos (x) \sin (x)-\frac {1}{2} x^2 \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x) \]

[Out]

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

________________________________________________________________________________________

Rubi [A]
time = 0.02, antiderivative size = 41, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3392, 30, 2715, 8} \begin {gather*} \frac {x^3}{6}-\frac {1}{2} x^2 \sin (x) \cos (x)-\frac {x}{4}+\frac {1}{2} x \sin ^2(x)+\frac {1}{4} \sin (x) \cos (x) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

-1/4*x + x^3/6 + (Cos[x]*Sin[x])/4 - (x^2*Cos[x]*Sin[x])/2 + (x*Sin[x]^2)/2

Rule 8

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

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rule 2715

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Sin[c + d*x])^(n - 1)/(d*n))
, x] + Dist[b^2*((n - 1)/n), Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integ
erQ[2*n]

Rule 3392

Int[((c_.) + (d_.)*(x_))^(m_)*((b_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[d*m*(c + d*x)^(m - 1)*((
b*Sin[e + f*x])^n/(f^2*n^2)), x] + (Dist[b^2*((n - 1)/n), Int[(c + d*x)^m*(b*Sin[e + f*x])^(n - 2), x], x] - D
ist[d^2*m*((m - 1)/(f^2*n^2)), Int[(c + d*x)^(m - 2)*(b*Sin[e + f*x])^n, x], x] - Simp[b*(c + d*x)^m*Cos[e + f
*x]*((b*Sin[e + f*x])^(n - 1)/(f*n)), x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n, 1] && GtQ[m, 1]

Rubi steps

\begin {align*} \int x^2 \sin ^2(x) \, dx &=-\frac {1}{2} x^2 \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x)+\frac {\int x^2 \, dx}{2}-\frac {1}{2} \int \sin ^2(x) \, dx\\ &=\frac {x^3}{6}+\frac {1}{4} \cos (x) \sin (x)-\frac {1}{2} x^2 \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x)-\frac {\int 1 \, dx}{4}\\ &=-\frac {x}{4}+\frac {x^3}{6}+\frac {1}{4} \cos (x) \sin (x)-\frac {1}{2} x^2 \cos (x) \sin (x)+\frac {1}{2} x \sin ^2(x)\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.02, size = 29, normalized size = 0.71 \begin {gather*} \frac {1}{24} \left (4 x^3-6 x \cos (2 x)+\left (3-6 x^2\right ) \sin (2 x)\right ) \end {gather*}

Antiderivative was successfully verified.

[In]

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

[Out]

(4*x^3 - 6*x*Cos[2*x] + (3 - 6*x^2)*Sin[2*x])/24

________________________________________________________________________________________

Mathics [A]
time = 2.04, size = 28, normalized size = 0.68 \begin {gather*} -\frac {x \text {Cos}\left [2 x\right ]}{4}-\frac {x^2 \text {Sin}\left [2 x\right ]}{4}+\frac {x^3}{6}+\frac {\text {Sin}\left [2 x\right ]}{8} \end {gather*}

Antiderivative was successfully verified.

[In]

mathics('Integrate[x^2*Sin[x]^2,x]')

[Out]

-x Cos[2 x] / 4 - x ^ 2 Sin[2 x] / 4 + x ^ 3 / 6 + Sin[2 x] / 8

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 37, normalized size = 0.90

method result size
meijerg \(\frac {x^{5} \hypergeom \left (\left [1, \frac {5}{2}\right ], \left [\frac {3}{2}, 2, \frac {7}{2}\right ], -x^{2}\right )}{5}\) \(19\)
risch \(\frac {x^{3}}{6}-\frac {x \cos \left (2 x \right )}{4}-\frac {\left (2 x^{2}-1\right ) \sin \left (2 x \right )}{8}\) \(27\)
default \(x^{2} \left (\frac {x}{2}-\frac {\cos \left (x \right ) \sin \left (x \right )}{2}\right )-\frac {x \left (\cos ^{2}\left (x \right )\right )}{2}+\frac {\cos \left (x \right ) \sin \left (x \right )}{4}+\frac {x}{4}-\frac {x^{3}}{3}\) \(37\)
norman \(\frac {x^{2} \left (\tan ^{3}\left (\frac {x}{2}\right )\right )-\frac {x}{4}+\frac {x^{3}}{6}-\frac {\left (\tan ^{3}\left (\frac {x}{2}\right )\right )}{2}+\frac {3 x \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{2}-\frac {x \left (\tan ^{4}\left (\frac {x}{2}\right )\right )}{4}-x^{2} \tan \left (\frac {x}{2}\right )+\frac {x^{3} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{3}+\frac {x^{3} \left (\tan ^{4}\left (\frac {x}{2}\right )\right )}{6}+\frac {\tan \left (\frac {x}{2}\right )}{2}}{\left (1+\tan ^{2}\left (\frac {x}{2}\right )\right )^{2}}\) \(94\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.34, size = 26, normalized size = 0.63 \begin {gather*} \frac {1}{6} \, x^{3} - \frac {1}{4} \, x \cos \left (2 \, x\right ) - \frac {1}{8} \, {\left (2 \, x^{2} - 1\right )} \sin \left (2 \, x\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

1/6*x^3 - 1/4*x*cos(2*x) - 1/8*(2*x^2 - 1)*sin(2*x)

________________________________________________________________________________________

Fricas [A]
time = 0.35, size = 29, normalized size = 0.71 \begin {gather*} \frac {1}{6} \, x^{3} - \frac {1}{2} \, x \cos \left (x\right )^{2} - \frac {1}{4} \, {\left (2 \, x^{2} - 1\right )} \cos \left (x\right ) \sin \left (x\right ) + \frac {1}{4} \, x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [A]
time = 0.17, size = 56, normalized size = 1.37 \begin {gather*} \frac {x^{3} \sin ^{2}{\left (x \right )}}{6} + \frac {x^{3} \cos ^{2}{\left (x \right )}}{6} - \frac {x^{2} \sin {\left (x \right )} \cos {\left (x \right )}}{2} + \frac {x \sin ^{2}{\left (x \right )}}{4} - \frac {x \cos ^{2}{\left (x \right )}}{4} + \frac {\sin {\left (x \right )} \cos {\left (x \right )}}{4} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**2*sin(x)**2,x)

[Out]

x**3*sin(x)**2/6 + x**3*cos(x)**2/6 - x**2*sin(x)*cos(x)/2 + x*sin(x)**2/4 - x*cos(x)**2/4 + sin(x)*cos(x)/4

________________________________________________________________________________________

Giac [A]
time = 0.00, size = 35, normalized size = 0.85 \begin {gather*} -\frac {4}{16} x \cos \left (2 x\right )-\frac {1}{16} \left (4 x^{2}-2\right ) \sin \left (2 x\right )+\frac {1}{2}\cdot \frac {1}{3} x^{3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*sin(x)^2,x)

[Out]

1/6*x^3 - 1/4*x*cos(2*x) - 1/8*(2*x^2 - 1)*sin(2*x)

________________________________________________________________________________________

Mupad [B]
time = 0.06, size = 28, normalized size = 0.68 \begin {gather*} \frac {\sin \left (2\,x\right )}{8}-\frac {x\,\cos \left (2\,x\right )}{4}-\frac {x^2\,\sin \left (2\,x\right )}{4}+\frac {x^3}{6} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

sin(2*x)/8 - (x*cos(2*x))/4 - (x^2*sin(2*x))/4 + x^3/6

________________________________________________________________________________________