85.33.78 problem 79

Internal problem ID [22701]
Book : Applied Differential Equations. By Murray R. Spiegel. 3rd edition. 1980. Pearson. ISBN 978-0130400970
Section : Chapter two. First order and simple higher order ordinary differential equations. A Exercises at page 65
Problem number : 79
Date solved : Thursday, October 02, 2025 at 09:11:03 PM
CAS classification : [_linear]

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