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

Optimal. Leaf size=17 \[ x^2 (-\cos (x))+2 x \sin (x)+2 \cos (x) \]

[Out]

2*cos(x)-x^2*cos(x)+2*x*sin(x)

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.333, Rules used = {3296, 2638} \[ x^2 (-\cos (x))+2 x \sin (x)+2 \cos (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

2*Cos[x] - x^2*Cos[x] + 2*x*Sin[x]

Rule 2638

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3296

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

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.02, size = 15, normalized size = 0.88 \[ 2 x \sin (x)-\left (x^2-2\right ) \cos (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

-((-2 + x^2)*Cos[x]) + 2*x*Sin[x]

________________________________________________________________________________________

fricas [A]  time = 0.41, size = 15, normalized size = 0.88 \[ -{\left (x^{2} - 2\right )} \cos \relax (x) + 2 \, x \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(x^2 - 2)*cos(x) + 2*x*sin(x)

________________________________________________________________________________________

giac [A]  time = 0.01, size = 15, normalized size = 0.88 \[ -{\left (x^{2} - 2\right )} \cos \relax (x) + 2 \, x \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(x^2 - 2)*cos(x) + 2*x*sin(x)

________________________________________________________________________________________

maple [A]  time = 0.01, size = 18, normalized size = 1.06 \[ -x^{2} \cos \relax (x )+2 x \sin \relax (x )+2 \cos \relax (x ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*cos(x)-x^2*cos(x)+2*x*sin(x)

________________________________________________________________________________________

maxima [A]  time = 0.56, size = 15, normalized size = 0.88 \[ -{\left (x^{2} - 2\right )} \cos \relax (x) + 2 \, x \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

-(x^2 - 2)*cos(x) + 2*x*sin(x)

________________________________________________________________________________________

mupad [B]  time = 0.03, size = 15, normalized size = 0.88 \[ 2\,x\,\sin \relax (x)-\cos \relax (x)\,\left (x^2-2\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

2*x*sin(x) - cos(x)*(x^2 - 2)

________________________________________________________________________________________

sympy [A]  time = 0.34, size = 17, normalized size = 1.00 \[ - x^{2} \cos {\relax (x )} + 2 x \sin {\relax (x )} + 2 \cos {\relax (x )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________