23.1.153 problem 154

Internal problem ID [4760]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 1. THE DIFFERENTIAL EQUATION IS OF FIRST ORDER AND OF FIRST DEGREE, page 223
Problem number : 154
Date solved : Tuesday, September 30, 2025 at 08:30:43 AM
CAS classification : [_linear]

\begin{align*} x y^{\prime }&=\sin \left (x \right )-2 y \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 17
ode:=x*diff(y(x),x) = sin(x)-2*y(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\sin \left (x \right )-\cos \left (x \right ) x +c_1}{x^{2}} \]
Mathematica. Time used: 0.024 (sec). Leaf size: 25
ode=x*D[y[x],x]==Sin[x]-2*y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {\int _1^xK[1] \sin (K[1])dK[1]+c_1}{x^2} \end{align*}
Sympy. Time used: 0.178 (sec). Leaf size: 15
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) + 2*y(x) - sin(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {\frac {C_{1}}{x} - \cos {\left (x \right )} + \frac {\sin {\left (x \right )}}{x}}{x} \]