3.3.72 \(\int e^{-x} x^4 \sin (x) \, dx\) [272]

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

[Out]

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

________________________________________________________________________________________

Rubi [B] Leaf count is larger than twice the leaf count of optimal. \(93\) vs. \(2(44)=88\).
time = 0.42, antiderivative size = 93, normalized size of antiderivative = 2.11, number of steps used = 53, number of rules used = 5, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.454, Rules used = {4517, 4553, 14, 4518, 4554} \begin {gather*} -\frac {1}{2} e^{-x} x^4 \sin (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-2 e^{-x} x^3 \cos (x)+3 e^{-x} x^2 \sin (x)-3 e^{-x} x^2 \cos (x)+6 e^{-x} x \sin (x)+3 e^{-x} \sin (x)+3 e^{-x} \cos (x) \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(x^4*Sin[x])/E^x,x]

[Out]

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

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 4517

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 4518

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 4553

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 4554

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 {gather*} \begin {aligned} \text {Integral} &=-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)-4 \int x^3 \left (-\frac {1}{2} e^{-x} \cos (x)-\frac {1}{2} e^{-x} \sin (x)\right ) \, dx\\ &=-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)-4 \int \left (-\frac {1}{2} e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^3 \sin (x)\right ) \, dx\\ &=-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \int e^{-x} x^3 \cos (x) \, dx+2 \int e^{-x} x^3 \sin (x) \, dx\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)-6 \int x^2 \left (-\frac {1}{2} e^{-x} \cos (x)-\frac {1}{2} e^{-x} \sin (x)\right ) \, dx-6 \int x^2 \left (-\frac {1}{2} e^{-x} \cos (x)+\frac {1}{2} e^{-x} \sin (x)\right ) \, dx\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)-6 \int \left (-\frac {1}{2} e^{-x} x^2 \cos (x)-\frac {1}{2} e^{-x} x^2 \sin (x)\right ) \, dx-6 \int \left (-\frac {1}{2} e^{-x} x^2 \cos (x)+\frac {1}{2} e^{-x} x^2 \sin (x)\right ) \, dx\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \left (3 \int e^{-x} x^2 \cos (x) \, dx\right )\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \left (-\frac {3}{2} e^{-x} x^2 \cos (x)+\frac {3}{2} e^{-x} x^2 \sin (x)-6 \int x \left (-\frac {1}{2} e^{-x} \cos (x)+\frac {1}{2} e^{-x} \sin (x)\right ) \, dx\right )\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \left (-\frac {3}{2} e^{-x} x^2 \cos (x)+\frac {3}{2} e^{-x} x^2 \sin (x)-6 \int \left (-\frac {1}{2} e^{-x} x \cos (x)+\frac {1}{2} e^{-x} x \sin (x)\right ) \, dx\right )\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \left (-\frac {3}{2} e^{-x} x^2 \cos (x)+\frac {3}{2} e^{-x} x^2 \sin (x)+3 \int e^{-x} x \cos (x) \, dx-3 \int e^{-x} x \sin (x) \, dx\right )\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \left (-\frac {3}{2} e^{-x} x^2 \cos (x)+3 e^{-x} x \sin (x)+\frac {3}{2} e^{-x} x^2 \sin (x)+3 \int \left (-\frac {1}{2} e^{-x} \cos (x)-\frac {1}{2} e^{-x} \sin (x)\right ) \, dx-3 \int \left (-\frac {1}{2} e^{-x} \cos (x)+\frac {1}{2} e^{-x} \sin (x)\right ) \, dx\right )\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \left (-\frac {3}{2} e^{-x} x^2 \cos (x)+3 e^{-x} x \sin (x)+\frac {3}{2} e^{-x} x^2 \sin (x)-2 \left (\frac {3}{2} \int e^{-x} \sin (x) \, dx\right )\right )\\ &=-2 e^{-x} x^3 \cos (x)-\frac {1}{2} e^{-x} x^4 \cos (x)-\frac {1}{2} e^{-x} x^4 \sin (x)+2 \left (-\frac {3}{2} e^{-x} x^2 \cos (x)+3 e^{-x} x \sin (x)+\frac {3}{2} e^{-x} x^2 \sin (x)-2 \left (-\frac {3}{4} e^{-x} \cos (x)-\frac {3}{4} e^{-x} \sin (x)\right )\right )\\ \end {aligned} \end {gather*}

________________________________________________________________________________________

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

Antiderivative was successfully verified.

[In]

Integrate[(x^4*Sin[x])/E^x,x]

[Out]

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

________________________________________________________________________________________

Maple [A]
time = 0.12, size = 48, normalized size = 1.09

method result size
parallelrisch \(-\frac {\left (\left (x^{4}+4 x^{3}+6 x^{2}-6\right ) \cos \left (x \right )+\sin \left (x \right ) \left (x^{4}-6 x^{2}-12 x -6\right )\right ) {\mathrm e}^{-x}}{2}\) \(42\)
default \(\left (-\frac {1}{2} x^{4}-2 x^{3}-3 x^{2}+3\right ) {\mathrm e}^{-x} \cos \left (x \right )+\left (-\frac {1}{2} x^{4}+3 x^{2}+6 x +3\right ) {\mathrm e}^{-x} \sin \left (x \right )\) \(48\)
risch \(\left (-\frac {1}{4}+\frac {i}{4}\right ) \left (x^{4}+2 i x^{3}+2 x^{3}+6 i x^{2}+6 i x -6 x -6\right ) {\mathrm e}^{\left (-1+i\right ) x}+\left (-\frac {1}{4}-\frac {i}{4}\right ) \left (x^{4}-2 i x^{3}+2 x^{3}-6 i x^{2}-6 i x -6 x -6\right ) {\mathrm e}^{\left (-1-i\right ) x}\) \(80\)
norman \(\frac {-3 x^{2} {\mathrm e}^{-x}-2 x^{3} {\mathrm e}^{-x}-\frac {x^{4} {\mathrm e}^{-x}}{2}+6 \,{\mathrm e}^{-x} \tan \left (\frac {x}{2}\right )-3 \,{\mathrm e}^{-x} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+12 x \,{\mathrm e}^{-x} \tan \left (\frac {x}{2}\right )+6 x^{2} {\mathrm e}^{-x} \tan \left (\frac {x}{2}\right )+3 x^{2} {\mathrm e}^{-x} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )+2 x^{3} {\mathrm e}^{-x} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )-x^{4} {\mathrm e}^{-x} \tan \left (\frac {x}{2}\right )+\frac {x^{4} {\mathrm e}^{-x} \left (\tan ^{2}\left (\frac {x}{2}\right )\right )}{2}+3 \,{\mathrm e}^{-x}}{1+\tan ^{2}\left (\frac {x}{2}\right )}\) \(150\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Maxima [A]
time = 0.36, size = 41, normalized size = 0.93 \begin {gather*} -\frac {1}{2} \, {\left ({\left (x^{4} + 4 \, x^{3} + 6 \, x^{2} - 6\right )} \cos \left (x\right ) + {\left (x^{4} - 6 \, x^{2} - 12 \, x - 6\right )} \sin \left (x\right )\right )} e^{\left (-x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

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

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 85 vs. \(2 (36) = 72\).
time = 1.19, size = 85, normalized size = 1.93 \begin {gather*} - \frac {x^{4} e^{- x} \sin {\left (x \right )}}{2} - \frac {x^{4} e^{- x} \cos {\left (x \right )}}{2} - 2 x^{3} e^{- x} \cos {\left (x \right )} + 3 x^{2} e^{- x} \sin {\left (x \right )} - 3 x^{2} e^{- x} \cos {\left (x \right )} + 6 x e^{- x} \sin {\left (x \right )} + 3 e^{- x} \sin {\left (x \right )} + 3 e^{- x} \cos {\left (x \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**4*exp(-x)*sin(x),x)

[Out]

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

________________________________________________________________________________________

Giac [A]
time = 0.45, size = 41, normalized size = 0.93 \begin {gather*} -\frac {1}{2} \, {\left ({\left (x^{4} + 4 \, x^{3} + 6 \, x^{2} - 6\right )} \cos \left (x\right ) + {\left (x^{4} - 6 \, x^{2} - 12 \, x - 6\right )} \sin \left (x\right )\right )} e^{\left (-x\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

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

[Out]

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

________________________________________________________________________________________

Mupad [B]
time = 0.26, size = 55, normalized size = 1.25 \begin {gather*} \frac {{\mathrm {e}}^{-x}\,\left (6\,\cos \left (x\right )+6\,\sin \left (x\right )-6\,x^2\,\cos \left (x\right )-4\,x^3\,\cos \left (x\right )-x^4\,\cos \left (x\right )+6\,x^2\,\sin \left (x\right )-x^4\,\sin \left (x\right )+12\,x\,\sin \left (x\right )\right )}{2} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^4*exp(-x)*sin(x),x)

[Out]

(exp(-x)*(6*cos(x) + 6*sin(x) - 6*x^2*cos(x) - 4*x^3*cos(x) - x^4*cos(x) + 6*x^2*sin(x) - x^4*sin(x) + 12*x*si
n(x)))/2

________________________________________________________________________________________

Chatgpt [F] Failed to verify
time = 1.00, size = 97, normalized size = 2.20 \begin {gather*} \left (-x^{4}-4 x^{3}-12 x^{2}-24 x -24\right ) \cos \left (x \right )-\left (x^{4}-4 x^{3}+12 x^{2}+48 x +48\right ) \sin \left (x \right )+24 x \,{\mathrm e}^{-x} \sin \left (x \right )+\left (3 x^{4}-12 x^{3}+12 x \right ) {\mathrm e}^{-x} \cos \left (x \right )+\left (3 x^{4}-12 x^{3}+12 x \right ) {\mathrm e}^{-x} \sin \left (x \right ) \end {gather*}

Warning: Unable to verify antiderivative.

[In]

int(x^4*exp(-x)*sin(x),x)

[Out]

(-x^4-4*x^3-12*x^2-24*x-24)*cos(x)-(x^4-4*x^3+12*x^2+48*x+48)*sin(x)+24*x*exp(-x)*sin(x)+(3*x^4-12*x^3+12*x)*e
xp(-x)*cos(x)+(3*x^4-12*x^3+12*x)*exp(-x)*sin(x)

________________________________________________________________________________________