4.6.18 \(a x (1-x y(x))+x^2 y'(x)+x^2 \left (-y(x)^2\right )+2=0\)

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.181816 (sec), leaf count = 109

\[\left \{\left \{y(x)\to \frac {a^6 c_1 x^3 e^{a x}-a^5 c_1 x^2 e^{a x}+2 a^4 c_1 x e^{a x}-2 a^3 c_1 e^{a x}+1}{a^5 c_1 x^3 \left (-e^{a x}\right )+2 a^4 c_1 x^2 e^{a x}-2 a^3 c_1 x e^{a x}+x}\right \}\right \}\]

Maple
cpu = 0.089 (sec), leaf count = 52

\[ \left \{ y \left ( x \right ) ={\frac {- \left ( ax-1 \right ) \left ( {a}^{2}{x}^{2}+2 \right ) {{\rm e}^{ax}}+{\it \_C1}}{ \left ( \left ( {a}^{2}{x}^{2}-2\,ax+2 \right ) {{\rm e}^{ax}}+{\it \_C1} \right ) x}} \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] -> (1 - 2*a^3*E^(a*x)*C[1] + 2*a^4*E^(a*x)*x*C[1] - a^5*E^(a*x)*x^2*C[1] 
+ a^6*E^(a*x)*x^3*C[1])/(x - 2*a^3*E^(a*x)*x*C[1] + 2*a^4*E^(a*x)*x^2*C[1] - a^5
*E^(a*x)*x^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),'implicit')

Maple raw output

y(x) = (-(a*x-1)*(a^2*x^2+2)*exp(a*x)+_C1)/((a^2*x^2-2*a*x+2)*exp(a*x)+_C1)/x