26.5.6 problem 8

Internal problem ID [4280]
Book : Differential equations with applications and historial notes, George F. Simmons. Second edition. 1971
Section : Chapter 2, End of chapter, page 61
Problem number : 8
Date solved : Tuesday, March 04, 2025 at 06:04:54 PM
CAS classification : [_linear]

\begin{align*} x y^{\prime }+y&=x \cos \left (x \right ) \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 16
ode:=x*diff(y(x),x)+y(x) = x*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \frac {\cos \left (x \right )+x \sin \left (x \right )+c_{1}}{x} \]
Mathematica. Time used: 0.036 (sec). Leaf size: 18
ode=x*D[y[x],x]+y[x]==x*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {x \sin (x)+\cos (x)+c_1}{x} \]
Sympy. Time used: 0.287 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*cos(x) + x*Derivative(y(x), x) + y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1}}{x} + \sin {\left (x \right )} + \frac {\cos {\left (x \right )}}{x} \]