29.9.18 problem 258

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

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

Maple. Time used: 0.303 (sec). Leaf size: 24
ode:=x^2*diff(y(x),x) = (1+2*x-y(x))^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = 1+\frac {x \left (c_1 \,x^{3}-4\right )}{c_1 \,x^{3}-1} \]
Mathematica. Time used: 0.283 (sec). Leaf size: 41
ode=x^2 D[y[x],x]==(1+2 x-y[x])^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {x^4+x^3+12 c_1 x+3 c_1}{x^3+3 c_1} \\ y(x)\to 4 x+1 \\ \end{align*}
Sympy. Time used: 0.415 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*Derivative(y(x), x) - (2*x - y(x) + 1)**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {4 C_{1} x + C_{1} + x^{4} + x^{3} - 4 x - 1}{C_{1} + x^{3} - 1} \]