89.3.21 problem 22

Internal problem ID [24319]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 2. Equations of the first order and first degree. Exercises at page 34
Problem number : 22
Date solved : Thursday, October 02, 2025 at 10:17:52 PM
CAS classification : [_exact, _rational, [_1st_order, `_with_symmetry_[F(x),G(x)]`], [_Abel, `2nd type`, `class B`]]

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