28.1.16 problem 16

Internal problem ID [4322]
Book : Differential equations for engineers by Wei-Chau XIE, Cambridge Press 2010
Section : Chapter 2. First-Order and Simple Higher-Order Differential Equations. Page 78
Problem number : 16
Date solved : Tuesday, March 04, 2025 at 06:23:18 PM
CAS classification : [[_homogeneous, `class C`], _rational, [_Abel, `2nd type`, `class A`]]

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

Maple. Time used: 0.397 (sec). Leaf size: 47
ode:=diff(y(x),x) = (2*x+y(x)-1)/(x-y(x)-2); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = -1-\tan \left (\operatorname {RootOf}\left (\sqrt {2}\, \ln \left (\sec \left (\textit {\_Z} \right )^{2} \left (x -1\right )^{2}\right )+\sqrt {2}\, \ln \left (2\right )+2 \sqrt {2}\, c_{1} +2 \textit {\_Z} \right )\right ) \left (x -1\right ) \sqrt {2} \]
Mathematica. Time used: 0.113 (sec). Leaf size: 75
ode=D[y[x],x]==(2*x+y[x]-1)/(x-y[x]-2); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [2 \sqrt {2} \arctan \left (\frac {y(x)+2 x-1}{\sqrt {2} (-y(x)+x-2)}\right )+\log (9)=2 \log \left (\frac {2 x^2+y(x)^2+2 y(x)-4 x+3}{(x-1)^2}\right )+4 \log (x-1)+3 c_1,y(x)\right ] \]
Sympy. Time used: 2.466 (sec). Leaf size: 48
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) - (2*x + y(x) - 1)/(x - y(x) - 2),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \log {\left (x - 1 \right )} = C_{1} - \log {\left (\sqrt {2 + \frac {\left (y{\left (x \right )} + 1\right )^{2}}{\left (x - 1\right )^{2}}} \right )} + \frac {\sqrt {2} \operatorname {atan}{\left (\frac {\sqrt {2} \left (y{\left (x \right )} + 1\right )}{2 \left (x - 1\right )} \right )}}{2} \]