20.4.44 problem Problem 62

Internal problem ID [3679]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 1, First-Order Differential Equations. Section 1.8, Change of Variables. page 79
Problem number : Problem 62
Date solved : Sunday, March 30, 2025 at 02:05:00 AM
CAS classification : [[_homogeneous, `class G`], _rational, _Riccati]

\begin{align*} y^{\prime }+\frac {2 y}{x}-y^{2}&=-\frac {2}{x^{2}} \end{align*}

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