61.2.58 problem 58

Internal problem ID [11985]
Book : Handbook of exact solutions for ordinary differential equations. By Polyanin and Zaitsev. Second edition
Section : Chapter 1, section 1.2. Riccati Equation. 1.2.2. Equations Containing Power Functions
Problem number : 58
Date solved : Sunday, March 30, 2025 at 09:54:05 PM
CAS classification : [_rational, [_1st_order, `_with_symmetry_[F(x),G(x)]`], _Riccati]

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

Maple. Time used: 0.003 (sec). Leaf size: 31
ode:=(a*x^2+b)*diff(y(x),x)+y(x)^2-2*x*y(x)+(-a+1)*x^2-b = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = x +\frac {\sqrt {b a}}{c_1 \sqrt {b a}+\arctan \left (\frac {a x}{\sqrt {b a}}\right )} \]
Mathematica. Time used: 0.372 (sec). Leaf size: 38
ode=(a*x^2+b)*D[y[x],x]+y[x]^2-2*x*y[x]+(1-a)*x^2-b==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to x+\frac {1}{-\int _1^x-\frac {1}{a K[1]^2+b}dK[1]+c_1} \\ y(x)\to x \\ \end{align*}
Sympy. Time used: 17.018 (sec). Leaf size: 114
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
y = Function("y") 
ode = Eq(-b + x**2*(1 - a) - 2*x*y(x) + (a*x**2 + b)*Derivative(y(x), x) + y(x)**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} x - x \sqrt {- \frac {1}{a b}} \log {\left (- b \sqrt {- \frac {1}{a b}} + x \right )} + x \sqrt {- \frac {1}{a b}} \log {\left (b \sqrt {- \frac {1}{a b}} + x \right )} + 2}{C_{1} - \sqrt {- \frac {1}{a b}} \log {\left (- b \sqrt {- \frac {1}{a b}} + x \right )} + \sqrt {- \frac {1}{a b}} \log {\left (b \sqrt {- \frac {1}{a b}} + x \right )}} \]