4.7.24 \(k (-a+y(x)+x)^2+(x-a)^2 y'(x)+y(x)^2=0\)

ODE
\[ k (-a+y(x)+x)^2+(x-a)^2 y'(x)+y(x)^2=0 \] ODE Classification

[[_homogeneous, `class C`], _rational, _Riccati]

Book solution method
Riccati ODE, Generalized ODE

Mathematica
cpu = 0.0226401 (sec), leaf count = 34

\[\left \{\left \{y(x)\to \frac {1}{\frac {k+1}{a-x}+c_1}+\frac {k (a-x)}{k+1}\right \}\right \}\]

Maple
cpu = 0.037 (sec), leaf count = 57

\[ \left \{ \ln \left ( {\frac {x+y \left ( x \right ) -a}{a-x}} \right ) -\ln \left ( {\frac { \left ( k+1 \right ) y \left ( x \right ) -k \left ( a-x \right ) }{a-x}} \right ) -\ln \left ( a-x \right ) -{\it \_C1}=0 \right \} \] Mathematica raw input

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

Mathematica raw output

{{y[x] -> (k*(a - x))/(1 + k) + ((1 + k)/(a - x) + C[1])^(-1)}}

Maple raw input

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

Maple raw output

ln((x+y(x)-a)/(a-x))-ln(((k+1)*y(x)-k*(a-x))/(a-x))-ln(a-x)-_C1 = 0