3.95 \(\int x^2 \sin ^2(x) \, dx\)

Optimal. Leaf size=41 \[ \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) \]

[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.03, 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 = {3311, 30, 2635, 8} \[ \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) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-x/4 + 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 2635

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] && Integer
Q[2*n]

Rule 3311

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.04, size = 29, normalized size = 0.71 \[ \frac {1}{24} \left (4 x^3+\left (3-6 x^2\right ) \sin (2 x)-6 x \cos (2 x)\right ) \]

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

________________________________________________________________________________________

fricas [A]  time = 0.45, size = 29, normalized size = 0.71 \[ \frac {1}{6} \, x^{3} - \frac {1}{2} \, x \cos \relax (x)^{2} - \frac {1}{4} \, {\left (2 \, x^{2} - 1\right )} \cos \relax (x) \sin \relax (x) + \frac {1}{4} \, x \]

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

________________________________________________________________________________________

giac [A]  time = 1.01, size = 26, normalized size = 0.63 \[ \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 ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.00, size = 37, normalized size = 0.90 \[ -\frac {x^{3}}{3}-\frac {x \left (\cos ^{2}\relax (x )\right )}{2}+\left (-\frac {\cos \relax (x ) \sin \relax (x )}{2}+\frac {x}{2}\right ) x^{2}+\frac {\cos \relax (x ) \sin \relax (x )}{4}+\frac {x}{4} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.43, size = 26, normalized size = 0.63 \[ \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 ) \]

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)

________________________________________________________________________________________

mupad [B]  time = 0.16, size = 28, normalized size = 0.68 \[ \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} \]

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

________________________________________________________________________________________

sympy [A]  time = 0.63, size = 56, normalized size = 1.37 \[ \frac {x^{3} \sin ^{2}{\relax (x )}}{6} + \frac {x^{3} \cos ^{2}{\relax (x )}}{6} - \frac {x^{2} \sin {\relax (x )} \cos {\relax (x )}}{2} + \frac {x \sin ^{2}{\relax (x )}}{4} - \frac {x \cos ^{2}{\relax (x )}}{4} + \frac {\sin {\relax (x )} \cos {\relax (x )}}{4} \]

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

________________________________________________________________________________________