ODE
\[ a x (1-x y(x))+x^2 y'(x)+x^2 \left (-y(x)^2\right )+2=0 \] ODE Classification
[_rational, _Riccati]
Book solution method
Riccati ODE, Generalized ODE
Mathematica ✓
cpu = 0.365322 (sec), leaf count = 71
\[\left \{\left \{y(x)\to \frac {e^{a x} \left (-a^3 x^3+a^2 x^2-2 a x+2\right )+a^3 c_1}{x \left (e^{a x} \left (a^2 x^2-2 a x+2\right )+a^3 c_1\right )}\right \}\right \}\]
Maple ✓
cpu = 0.118 (sec), leaf count = 61
\[\left [y \left (x \right ) = -\frac {\left (a^{3} x^{3}-a^{2} x^{2}+2 a x -2\right ) {\mathrm e}^{a x}-\textit {\_C1}}{x \left (\left (a^{2} x^{2}-2 a x +2\right ) {\mathrm e}^{a x}+\textit {\_C1} \right )}\right ]\] Mathematica raw input
DSolve[2 - x^2*y[x]^2 + a*x*(1 - x*y[x]) + x^2*y'[x] == 0,y[x],x]
Mathematica raw output
{{y[x] -> (E^(a*x)*(2 - 2*a*x + a^2*x^2 - a^3*x^3) + a^3*C[1])/(x*(E^(a*x)*(2 -
2*a*x + a^2*x^2) + a^3*C[1]))}}
Maple raw input
dsolve(x^2*diff(y(x),x)+2+a*x*(1-x*y(x))-x^2*y(x)^2 = 0, y(x))
Maple raw output
[y(x) = -((a^3*x^3-a^2*x^2+2*a*x-2)*exp(a*x)-_C1)/x/((a^2*x^2-2*a*x+2)*exp(a*x)+
_C1)]