75.12.21 problem 295

Internal problem ID [16808]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Section 12. Miscellaneous problems. Exercises page 93
Problem number : 295
Date solved : Thursday, March 13, 2025 at 08:51:36 AM
CAS classification : [[_homogeneous, `class D`], _rational, _Bernoulli]

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

Maple. Time used: 0.003 (sec). Leaf size: 16
ode:=x*y(x)^2+y(x)-x*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {2 x}{x^{2}-2 c_{1}} \]
Mathematica. Time used: 0.142 (sec). Leaf size: 23
ode=(x*y[x]^2+y[x])-x*D[y[x],x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -\frac {2 x}{x^2-2 c_1} \\ y(x)\to 0 \\ \end{align*}
Sympy. Time used: 0.192 (sec). Leaf size: 10
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*y(x)**2 - x*Derivative(y(x), x) + y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {2 x}{C_{1} - x^{2}} \]