4.24.42 \(y''(x)+y(x)=e^x \left (x^2-1\right )\)

ODE
\[ y''(x)+y(x)=e^x \left (x^2-1\right ) \] ODE Classification

[[_2nd_order, _linear, _nonhomogeneous]]

Book solution method
TO DO

Mathematica
cpu = 0.0940996 (sec), leaf count = 27

\[\left \{\left \{y(x)\to c_2 \sin (x)+c_1 \cos (x)+\frac {1}{2} e^x (x-2) x\right \}\right \}\]

Maple
cpu = 0.105 (sec), leaf count = 24

\[ \left \{ y \left ( x \right ) ={\frac { \left ( {x}^{2}-2\,x \right ) {{\rm e}^{x}}}{2}}+\cos \left ( x \right ) {\it \_C1}+\sin \left ( x \right ) {\it \_C2} \right \} \] Mathematica raw input

DSolve[y[x] + y''[x] == E^x*(-1 + x^2),y[x],x]

Mathematica raw output

{{y[x] -> (E^x*(-2 + x)*x)/2 + C[1]*Cos[x] + C[2]*Sin[x]}}

Maple raw input

dsolve(diff(diff(y(x),x),x)+y(x) = exp(x)*(x^2-1), y(x),'implicit')

Maple raw output

y(x) = 1/2*(x^2-2*x)*exp(x)+cos(x)*_C1+sin(x)*_C2