29.8.21 problem 21

Internal problem ID [7363]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 13. Miscellaneous problems. page 466
Problem number : 21
Date solved : Tuesday, September 30, 2025 at 04:29:47 PM
CAS classification : [_separable]

\begin{align*} y^{\prime }+x y&=\frac {x}{y} \end{align*}
Maple. Time used: 0.005 (sec). Leaf size: 33
ode:=diff(y(x),x)+x*y(x) = x/y(x); 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y &= \sqrt {{\mathrm e}^{-x^{2}} c_1 +1} \\ y &= -\sqrt {{\mathrm e}^{-x^{2}} c_1 +1} \\ \end{align*}
Mathematica. Time used: 1.799 (sec). Leaf size: 57
ode=D[y[x],x]+x*y[x]==x/y[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\sqrt {1+e^{-x^2+2 c_1}}\\ y(x)&\to \sqrt {1+e^{-x^2+2 c_1}}\\ y(x)&\to -1\\ y(x)&\to 1 \end{align*}
Sympy. Time used: 0.284 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*y(x) - x/y(x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = - \sqrt {C_{1} e^{- x^{2}} + 1}, \ y{\left (x \right )} = \sqrt {C_{1} e^{- x^{2}} + 1}\right ] \]