29.21.18 problem 594

Internal problem ID [5188]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 21
Problem number : 594
Date solved : Sunday, March 30, 2025 at 06:48:55 AM
CAS classification : [_separable]

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

Maple. Time used: 0.005 (sec). Leaf size: 27
ode:=y(x)^2*diff(y(x),x)+x*(2-y(x)) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ \frac {x^{2}}{2}-\frac {y^{2}}{2}-2 y-4 \ln \left (y-2\right )+c_1 = 0 \]
Mathematica. Time used: 0.356 (sec). Leaf size: 43
ode=y[x]^2*D[y[x],x]+x*(2-y[x])==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \text {InverseFunction}\left [\frac {\text {$\#$1}^2}{2}+2 \text {$\#$1}+4 \log (\text {$\#$1}-2)-6\&\right ]\left [\frac {x^2}{2}+c_1\right ] \\ y(x)\to 2 \\ \end{align*}
Sympy. Time used: 0.417 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*(2 - y(x)) + y(x)**2*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ - \frac {x^{2}}{2} + \frac {y^{2}{\left (x \right )}}{2} + 2 y{\left (x \right )} + 4 \log {\left (y{\left (x \right )} - 2 \right )} = C_{1} \]