23.1.274 problem 268

Internal problem ID [4881]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 1. THE DIFFERENTIAL EQUATION IS OF FIRST ORDER AND OF FIRST DEGREE, page 223
Problem number : 268
Date solved : Tuesday, September 30, 2025 at 08:50:29 AM
CAS classification : [_rational, _Riccati]

\begin{align*} x^{2} y^{\prime }+2+a x \left (1-x y\right )-x^{2} y^{2}&=0 \end{align*}
Maple. Time used: 0.002 (sec). Leaf size: 52
ode:=x^2*diff(y(x),x)+2+a*x*(1-x*y(x))-x^2*y(x)^2 = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-\left (a x -1\right ) \left (a^{2} x^{2}+2\right ) {\mathrm e}^{a x}+c_1}{\left (\left (a^{2} x^{2}-2 a x +2\right ) {\mathrm e}^{a x}+c_1 \right ) x} \]
Mathematica. Time used: 0.447 (sec). Leaf size: 76
ode=x^2*D[y[x],x]+2+a*x*(1-x*y[x])-x^2*y[x]^2==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {\int _1^xe^{a K[1]+2} K[1]^2dK[1]+x^3 \left (-e^{a x+2}\right )+c_1}{x \left (\int _1^xe^{a K[1]+2} K[1]^2dK[1]+c_1\right )}\\ y(x)&\to \frac {1}{x} \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(a*x*(-x*y(x) + 1) - x**2*y(x)**2 + x**2*Derivative(y(x), x) + 2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
NotImplementedError : The given ODE -a*y(x) + a/x - y(x)**2 + Derivative(y(x), x) + 2/x**2 cannot be solved by the factorable group method