10.6.10 problem 10

Internal problem ID [1227]
Book : Elementary differential equations and boundary value problems, 10th ed., Boyce and DiPrima
Section : Miscellaneous problems, end of chapter 2. Page 133
Problem number : 10
Date solved : Saturday, March 29, 2025 at 10:48:18 PM
CAS classification : [_separable]

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

Maple. Time used: 0.013 (sec). Leaf size: 26
ode:=(-x^2+x+1)/x^2+y(x)*diff(y(x),x)/(-2+y(x)) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = 2 \operatorname {LambertW}\left (\frac {c_1 \,{\mathrm e}^{\frac {\left (x -1\right )^{2}}{2 x}}}{2 \sqrt {x}}\right )+2 \]
Mathematica. Time used: 50.341 (sec). Leaf size: 68
ode=(-x^2+x+1)/x^2+y[x]*D[y[x],x]/(-2+y[x]) == 0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to 2 \left (1+W\left (-\frac {1}{2} \sqrt {\frac {e^{x+\frac {1}{x}-2+c_1}}{x}}\right )\right ) \\ y(x)\to 2 \left (1+W\left (\frac {1}{2} \sqrt {\frac {e^{x+\frac {1}{x}-2+c_1}}{x}}\right )\right ) \\ y(x)\to 2 \\ \end{align*}
Sympy. Time used: 2.137 (sec). Leaf size: 53
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x)*Derivative(y(x), x)/(y(x) - 2) + (-x**2 + x + 1)/x**2,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = 2 W\left (- \frac {\sqrt {\frac {C_{1} e^{x + \frac {1}{x}}}{x}}}{2 e}\right ) + 2, \ y{\left (x \right )} = 2 W\left (\frac {\sqrt {\frac {C_{1} e^{x + \frac {1}{x}}}{x}}}{2 e}\right ) + 2\right ] \]