73.3.3 problem 4.3 (c)

Internal problem ID [14958]
Book : Ordinary Differential Equations. An introduction to the fundamentals. Kenneth B. Howell. second edition. CRC Press. FL, USA. 2020
Section : Chapter 4. SEPARABLE FIRST ORDER EQUATIONS. Additional exercises. page 90
Problem number : 4.3 (c)
Date solved : Thursday, March 13, 2025 at 05:23:59 AM
CAS classification : [_rational, _Riccati]

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

Maple. Time used: 0.001 (sec). Leaf size: 67
ode:=x*diff(y(x),x) = (x-y(x))^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\sqrt {x}\, \left (\left (\operatorname {BesselK}\left (0, 2 \sqrt {x}\right ) c_{1} +\operatorname {BesselI}\left (0, 2 \sqrt {x}\right )\right ) \sqrt {x}+\operatorname {BesselK}\left (1, 2 \sqrt {x}\right ) c_{1} -\operatorname {BesselI}\left (1, 2 \sqrt {x}\right )\right )}{\operatorname {BesselK}\left (0, 2 \sqrt {x}\right ) c_{1} +\operatorname {BesselI}\left (0, 2 \sqrt {x}\right )} \]
Mathematica. Time used: 0.23 (sec). Leaf size: 121
ode=x*D[y[x],x]==(x-y[x])^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {x K_0\left (2 \sqrt {x}\right )+\sqrt {x} K_1\left (2 \sqrt {x}\right )+c_1 x \operatorname {BesselI}\left (0,2 \sqrt {x}\right )-c_1 \sqrt {x} \operatorname {BesselI}\left (1,2 \sqrt {x}\right )}{K_0\left (2 \sqrt {x}\right )+c_1 \operatorname {BesselI}\left (0,2 \sqrt {x}\right )} \\ y(x)\to x-\frac {\sqrt {x} \operatorname {BesselI}\left (1,2 \sqrt {x}\right )}{\operatorname {BesselI}\left (0,2 \sqrt {x}\right )} \\ \end{align*}
Sympy
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) - (x - y(x))**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
ValueError : Rational Solution doesnt exist