29.12.2 problem 321

Internal problem ID [4921]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 12
Problem number : 321
Date solved : Sunday, March 30, 2025 at 04:13:29 AM
CAS classification : [[_homogeneous, `class C`], _rational, _Riccati]

\begin{align*} \left (x -a \right )^{2} y^{\prime }+k \left (x +y-a \right )^{2}+y^{2}&=0 \end{align*}

Maple. Time used: 0.157 (sec). Leaf size: 34
ode:=(x-a)^2*diff(y(x),x)+k*(x+y(x)-a)^2+y(x)^2 = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (c_1 k \left (-x +a \right )-1\right ) \left (-x +a \right )}{-1+\left (k +1\right ) \left (-x +a \right ) c_1} \]
Mathematica. Time used: 0.228 (sec). Leaf size: 50
ode=(x-a)^2 D[y[x],x]+k(x+y[x]-a)^2+y[x]^2==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {k (a-x)}{k+1}+\frac {1}{\frac {k+1}{a-x}+c_1} \\ y(x)\to \frac {k (a-x)}{k+1} \\ \end{align*}
Sympy. Time used: 1.915 (sec). Leaf size: 54
from sympy import * 
x = symbols("x") 
a = symbols("a") 
k = symbols("k") 
y = Function("y") 
ode = Eq(k*(-a + x + y(x))**2 + (-a + x)**2*Derivative(y(x), x) + y(x)**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {- C_{1} a^{2} k + 2 C_{1} a k x - C_{1} k x^{2} - a k - a + k x + x}{- C_{1} a k - C_{1} a + C_{1} k x + C_{1} x - k - 1} \]