4.2.12 \(y'(x)=a (x-y(x)) y(x)+1\)

ODE
\[ y'(x)=a (x-y(x)) y(x)+1 \] ODE Classification

[_Riccati]

Book solution method
Riccati ODE, Generalized ODE

Mathematica
cpu = 0.0442847 (sec), leaf count = 88

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

Maple
cpu = 0.201 (sec), leaf count = 50

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

DSolve[y'[x] == 1 + a*(x - y[x])*y[x],y[x],x]

Mathematica raw output

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

Maple raw input

dsolve(diff(y(x),x) = 1+a*(x-y(x))*y(x), y(x),'implicit')

Maple raw output

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