23.3.15 problem 15

Internal problem ID [5729]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 3. THE DIFFERENTIAL EQUATION IS LINEAR AND OF SECOND ORDER, page 311
Problem number : 15
Date solved : Tuesday, September 30, 2025 at 02:02:11 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y+y^{\prime \prime }&=x \left (\cos \left (x \right )-x \sin \left (x \right )\right ) \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 20
ode:=y(x)+diff(diff(y(x),x),x) = x*(cos(x)-sin(x)*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (x^{3}+6 c_1 \right ) \cos \left (x \right )}{6}+\sin \left (x \right ) c_2 \]
Mathematica. Time used: 0.046 (sec). Leaf size: 24
ode=y[x] + D[y[x],{x,2}] == x*(Cos[x] - x*Sin[x]); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \left (\frac {x^3}{6}+c_1\right ) \cos (x)+c_2 \sin (x) \end{align*}
Sympy. Time used: 0.088 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*(-x*sin(x) + cos(x)) + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \sin {\left (x \right )} + \left (C_{1} + \frac {x^{3}}{6}\right ) \cos {\left (x \right )} \]