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.211544 (sec), leaf count = 24

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

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

\[\left [y \left (x \right ) = \sin \left (x \right ) \textit {\_C2} +\textit {\_C1} \cos \left (x \right )+\frac {\cos \left (x \right ) x^{3}}{6}\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))

Maple raw output

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