35.4.14 problem 25 part (a)

Internal problem ID [6132]
Book : Mathematical Methods in the Physical Sciences. third edition. Mary L. Boas. John Wiley. 2006
Section : Chapter 8, Ordinary differential equations. Section 4. OTHER METHODS FOR FIRST-ORDER EQUATIONS. page 406
Problem number : 25 part (a)
Date solved : Sunday, March 30, 2025 at 10:40:51 AM
CAS classification : [[_homogeneous, `class G`], _rational, _Riccati]

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

Maple. Time used: 0.004 (sec). Leaf size: 15
ode:=diff(y(x),x) = x*y(x)^2-2*y(x)/x-1/x^3; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\tanh \left (-\ln \left (x \right )+c_1 \right )}{x^{2}} \]
Mathematica. Time used: 1.198 (sec). Leaf size: 63
ode=D[y[x],x]== x*y[x]^2-2/x*y[x]-1/x^3; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {i \tan (i \log (x)+c_1)}{x^2} \\ y(x)\to \frac {-x^2+e^{2 i \text {Interval}[\{0,\pi \}]}}{x^4+x^2 e^{2 i \text {Interval}[\{0,\pi \}]}} \\ \end{align*}
Sympy. Time used: 0.284 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x*y(x)**2 + Derivative(y(x), x) + 2*y(x)/x + x**(-3),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {C_{1} - x^{2} - 1}{x^{2} \left (C_{1} + x^{2} - 1\right )} \]