4.24.39 \(y''(x)+y(x)=x (\cos (x)-x \sin (x))\)

ODE
\[ y''(x)+y(x)=x (\cos (x)-x \sin (x)) \] ODE Classification

[[_2nd_order, _linear, _nonhomogeneous]]

Book solution method
TO DO

Mathematica
cpu = 0.0553819 (sec), leaf count = 24

\[\left \{\left \{y(x)\to \left (c_1+\frac {x^3}{6}\right ) \cos (x)+c_2 \sin (x)\right \}\right \}\]

Maple
cpu = 0.079 (sec), leaf count = 20

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

DSolve[y[x] + y''[x] == x*(Cos[x] - x*Sin[x]),y[x],x]

Mathematica raw output

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

Maple raw input

dsolve(diff(diff(y(x),x),x)+y(x) = x*(cos(x)-x*sin(x)), y(x),'implicit')

Maple raw output

y(x) = 1/6*(x^3+6*_C1)*cos(x)+sin(x)*_C2