4.9.42 \((x-y(x)) y'(x)=y(x) (2 x y(x)+1)\)

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

[[_homogeneous, `class D`], _rational, [_Abel, `2nd type`, `class A`]]

Book solution method
Exact equation, integrating factor

Mathematica
cpu = 0.283847 (sec), leaf count = 24

\[\left \{\left \{y(x)\to -\frac {x}{W\left (x \left (-e^{x^2-c_1}\right )\right )}\right \}\right \}\]

Maple
cpu = 0.093 (sec), leaf count = 18

\[\left [y \left (x \right ) = -\frac {x}{\LambertW \left (-{\mathrm e}^{x^{2}} \textit {\_C1} x \right )}\right ]\] Mathematica raw input

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

Mathematica raw output

{{y[x] -> -(x/ProductLog[-(E^(x^2 - C[1])*x)])}}

Maple raw input

dsolve((x-y(x))*diff(y(x),x) = y(x)*(1+2*x*y(x)), y(x))

Maple raw output

[y(x) = -1/LambertW(-exp(x^2)*_C1*x)*x]