##### 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 Classiﬁcation

[_Riccati]

Book solution method
Riccati ODE, Generalized ODE

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

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

Maple
cpu = 0.103 (sec), leaf count = 67

$\left [y \left (x \right ) = \frac {2 \textit {\_C1} \,{\mathrm e}^{-\frac {x^{4}}{4}}}{\sqrt {\pi }\, \left (\erf \left (\frac {x^{2}}{2}\right ) \textit {\_C1} +1\right )}+\frac {\erf \left (\frac {x^{2}}{2}\right ) \sqrt {\pi }\, \textit {\_C1} \,x^{2}+x^{2} \sqrt {\pi }}{\sqrt {\pi }\, \left (\erf \left (\frac {x^{2}}{2}\right ) \textit {\_C1} +1\right )}\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))

Maple raw output

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