88.12.19 problem 21

Internal problem ID [24075]
Book : Elementary Differential Equations. By Lee Roy Wilcox and Herbert J. Curtis. 1961 first edition. International texbook company. Scranton, Penn. USA. CAT number 61-15976
Section : Chapter 2. Differential equations of first order. Miscellaneous Exercises at page 55
Problem number : 21
Date solved : Thursday, October 02, 2025 at 09:57:13 PM
CAS classification : [[_homogeneous, `class G`], _exact, _rational, _Bernoulli]

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