35.4.15 problem 25 part (b)

Internal problem ID [6133]
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 (b)
Date solved : Sunday, March 30, 2025 at 10:40:54 AM
CAS classification : [[_homogeneous, `class D`], _rational, _Riccati]

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

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