75.10.3 problem 234

Internal problem ID [16771]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Section 9. The Riccati equation. Exercises page 75
Problem number : 234
Date solved : Thursday, March 13, 2025 at 08:44:48 AM
CAS classification : [[_1st_order, _with_linear_symmetries], _rational, _Riccati]

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

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