3.565 \(\int e^x x^2 \sin (x) \, dx\)

Optimal. Leaf size=50 \[ \frac {1}{2} e^x x^2 \sin (x)-\frac {1}{2} e^x x^2 \cos (x)-\frac {1}{2} e^x \sin (x)+e^x x \cos (x)-\frac {1}{2} e^x \cos (x) \]

________________________________________________________________________________________

Rubi [A]  time = 0.11, antiderivative size = 50, normalized size of antiderivative = 1.00, number of steps used = 11, number of rules used = 5, integrand size = 9, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.556, Rules used = {4432, 4465, 14, 4433, 4466} \[ \frac {1}{2} e^x x^2 \sin (x)-\frac {1}{2} e^x x^2 \cos (x)-\frac {1}{2} e^x \sin (x)+e^x x \cos (x)-\frac {1}{2} e^x \cos (x) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

Rule 14

Int[(u_)*((c_.)*(x_))^(m_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*u, x], x] /; FreeQ[{c, m}, x] && SumQ[u]
 &&  !LinearQ[u, x] &&  !MatchQ[u, (a_) + (b_.)*(v_) /; FreeQ[{a, b}, x] && InverseFunctionQ[v]]

Rule 4432

Int[(F_)^((c_.)*((a_.) + (b_.)*(x_)))*Sin[(d_.) + (e_.)*(x_)], x_Symbol] :> Simp[(b*c*Log[F]*F^(c*(a + b*x))*S
in[d + e*x])/(e^2 + b^2*c^2*Log[F]^2), x] - Simp[(e*F^(c*(a + b*x))*Cos[d + e*x])/(e^2 + b^2*c^2*Log[F]^2), x]
 /; FreeQ[{F, a, b, c, d, e}, x] && NeQ[e^2 + b^2*c^2*Log[F]^2, 0]

Rule 4433

Int[Cos[(d_.) + (e_.)*(x_)]*(F_)^((c_.)*((a_.) + (b_.)*(x_))), x_Symbol] :> Simp[(b*c*Log[F]*F^(c*(a + b*x))*C
os[d + e*x])/(e^2 + b^2*c^2*Log[F]^2), x] + Simp[(e*F^(c*(a + b*x))*Sin[d + e*x])/(e^2 + b^2*c^2*Log[F]^2), x]
 /; FreeQ[{F, a, b, c, d, e}, x] && NeQ[e^2 + b^2*c^2*Log[F]^2, 0]

Rule 4465

Int[(F_)^((c_.)*((a_.) + (b_.)*(x_)))*((f_.)*(x_))^(m_.)*Sin[(d_.) + (e_.)*(x_)]^(n_.), x_Symbol] :> Module[{u
 = IntHide[F^(c*(a + b*x))*Sin[d + e*x]^n, x]}, Dist[(f*x)^m, u, x] - Dist[f*m, Int[(f*x)^(m - 1)*u, x], x]] /
; FreeQ[{F, a, b, c, d, e, f}, x] && IGtQ[n, 0] && GtQ[m, 0]

Rule 4466

Int[Cos[(d_.) + (e_.)*(x_)]^(n_.)*(F_)^((c_.)*((a_.) + (b_.)*(x_)))*((f_.)*(x_))^(m_.), x_Symbol] :> Module[{u
 = IntHide[F^(c*(a + b*x))*Cos[d + e*x]^n, x]}, Dist[(f*x)^m, u, x] - Dist[f*m, Int[(f*x)^(m - 1)*u, x], x]] /
; FreeQ[{F, a, b, c, d, e, f}, x] && IGtQ[n, 0] && GtQ[m, 0]

Rubi steps

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

________________________________________________________________________________________

Mathematica [A]  time = 0.04, size = 25, normalized size = 0.50 \[ \frac {1}{2} e^x \left (\left (x^2-1\right ) \sin (x)-(x-1)^2 \cos (x)\right ) \]

Antiderivative was successfully verified.

[In]

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

[Out]

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

________________________________________________________________________________________

IntegrateAlgebraic [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int e^x x^2 \sin (x) \, dx \]

Verification is Not applicable to the result.

[In]

IntegrateAlgebraic[E^x*x^2*Sin[x],x]

[Out]

Could not integrate

________________________________________________________________________________________

fricas [A]  time = 1.40, size = 26, normalized size = 0.52 \[ -\frac {1}{2} \, {\left (x^{2} - 2 \, x + 1\right )} \cos \relax (x) e^{x} + \frac {1}{2} \, {\left (x^{2} - 1\right )} e^{x} \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

giac [A]  time = 0.60, size = 25, normalized size = 0.50 \[ -\frac {1}{2} \, {\left ({\left (x^{2} - 2 \, x + 1\right )} \cos \relax (x) - {\left (x^{2} - 1\right )} \sin \relax (x)\right )} e^{x} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maple [A]  time = 0.06, size = 27, normalized size = 0.54




method result size



default \(\left (-\frac {1}{2} x^{2}+x -\frac {1}{2}\right ) {\mathrm e}^{x} \cos \relax (x )+\left (\frac {x^{2}}{2}-\frac {1}{2}\right ) {\mathrm e}^{x} \sin \relax (x )\) \(27\)
risch \(\left (-\frac {1}{4}-\frac {i}{4}\right ) \left (x^{2}+i x -x -i\right ) {\mathrm e}^{\left (1+i\right ) x}+\left (-\frac {1}{4}+\frac {i}{4}\right ) \left (x^{2}-i x -x +i\right ) {\mathrm e}^{\left (1-i\right ) x}\) \(48\)
norman \(\frac {{\mathrm e}^{x} x +{\mathrm e}^{x} x^{2} \tan \left (\frac {x}{2}\right )-\frac {{\mathrm e}^{x} x^{2}}{2}-{\mathrm e}^{x} \tan \left (\frac {x}{2}\right )+\frac {{\mathrm e}^{x} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{2}-{\mathrm e}^{x} x \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+\frac {{\mathrm e}^{x} x^{2} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{2}-\frac {{\mathrm e}^{x}}{2}}{1+\tan ^{2}\left (\frac {x}{2}\right )}\) \(80\)



Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

maxima [A]  time = 0.46, size = 26, normalized size = 0.52 \[ -\frac {1}{2} \, {\left (x^{2} - 2 \, x + 1\right )} \cos \relax (x) e^{x} + \frac {1}{2} \, {\left (x^{2} - 1\right )} e^{x} \sin \relax (x) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

mupad [B]  time = 0.33, size = 21, normalized size = 0.42 \[ \frac {{\mathrm {e}}^x\,\left (x-1\right )\,\left (\cos \relax (x)+\sin \relax (x)-x\,\cos \relax (x)+x\,\sin \relax (x)\right )}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

(exp(x)*(x - 1)*(cos(x) + sin(x) - x*cos(x) + x*sin(x)))/2

________________________________________________________________________________________

sympy [A]  time = 2.06, size = 48, normalized size = 0.96 \[ \frac {x^{2} e^{x} \sin {\relax (x )}}{2} - \frac {x^{2} e^{x} \cos {\relax (x )}}{2} + x e^{x} \cos {\relax (x )} - \frac {e^{x} \sin {\relax (x )}}{2} - \frac {e^{x} \cos {\relax (x )}}{2} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________