4.2.16 \(y'(x)=x \left (x^2 y(x)-y(x)^2+2\right )\)

ODE
\[ y'(x)=x \left (x^2 y(x)-y(x)^2+2\right ) \] ODE Classification

[_Riccati]

Book solution method
Riccati ODE, Generalized ODE

Mathematica
cpu = 0.0453608 (sec), leaf count = 63

\[\left \{\left \{y(x)\to \frac {2 c_1 x^2+\sqrt {\pi } x^2 \text {erf}\left (\frac {x^2}{2}\right )+2 e^{-\frac {x^4}{4}}}{2 c_1+\sqrt {\pi } \text {erf}\left (\frac {x^2}{2}\right )}\right \}\right \}\]

Maple
cpu = 0.341 (sec), leaf count = 51

\[ \left \{ y \relax (x ) ={\frac {1}{\sqrt {\pi }} \left ({\it Erf} \left ({\frac {{x}^{2}}{2}} \right ) \sqrt {\pi }{\it \_C1}\,{x}^{2}+{x}^{2}\sqrt {\pi }+2\,{{\rm e}^{-1/4\,{x}^{4}}}{\it \_C1} \right ) \left ({\it Erf} \left ({\frac {{x}^{2}}{2}} \right ) {\it \_C1}+1 \right ) ^{-1}} \right \} \] Mathematica raw input

DSolve[y'[x] == x*(2 + x^2*y[x] - y[x]^2),y[x],x]

Mathematica raw output

{{y[x] -> (2/E^(x^4/4) + 2*x^2*C[1] + Sqrt[Pi]*x^2*Erf[x^2/2])/(2*C[1] + Sqrt[Pi
]*Erf[x^2/2])}}

Maple raw input

dsolve(diff(y(x),x) = x*(2+x^2*y(x)-y(x)^2), y(x),'implicit')

Maple raw output

y(x) = (erf(1/2*x^2)*Pi^(1/2)*_C1*x^2+x^2*Pi^(1/2)+2*exp(-1/4*x^4)*_C1)/Pi^(1/2)
/(erf(1/2*x^2)*_C1+1)