23.3.14 problem 14

Internal problem ID [5728]
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 : 14
Date solved : Tuesday, September 30, 2025 at 02:02:11 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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