87.6.24 problem 27

Internal problem ID [23341]
Book : Ordinary differential equations with modern applications. Ladas, G. E. and Finizio, N. Wadsworth Publishing. California. 1978. ISBN 0-534-00552-7. QA372.F56
Section : Chapter 1. Elementary methods. First order differential equations. Exercise at page 53
Problem number : 27
Date solved : Thursday, October 02, 2025 at 09:39:07 PM
CAS classification : [[_homogeneous, `class C`], _rational, [_Abel, `2nd type`, `class A`]]

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

With initial conditions

\begin{align*} y \left (2\right )&=2 \\ \end{align*}
Maple. Time used: 0.548 (sec). Leaf size: 35
ode:=diff(y(x),x) = (2*x+y(x)-4)/(x-y(x)+1); 
ic:=[y(2) = 2]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = 2-\sqrt {2}\, \left (x -1\right ) \tan \left (\operatorname {RootOf}\left (\ln \left (\frac {\cos \left (\textit {\_Z} \right )^{2}}{\left (x -1\right )^{2}}\right ) \sqrt {2}-2 \textit {\_Z} \right )\right ) \]
Mathematica. Time used: 0.08 (sec). Leaf size: 90
ode=D[y[x],x]==(2*x+y[x]-4)/(x-y[x]+1); 
ic={y[2]==2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ \text {Solve}\left [2 \sqrt {2} \arctan \left (\frac {y(x)+2 x-4}{\sqrt {2} (-y(x)+x+1)}\right )+\log (9)=2 \sqrt {2} \arctan \left (\sqrt {2}\right )+2 \log \left (\frac {2 x^2+y(x)^2-4 y(x)-4 x+6}{(x-1)^2}\right )+4 \log (x-1)+\log (9)-2 \log (2),y(x)\right ] \]
Sympy. Time used: 1.267 (sec). Leaf size: 51
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(Derivative(y(x), x) - (2*x + y(x) - 4)/(x - y(x) + 1),0) 
ics = {y(2): 2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \log {\left (x - 1 \right )} = - \log {\left (\sqrt {2 + \frac {\left (y{\left (x \right )} - 2\right )^{2}}{\left (x - 1\right )^{2}}} \right )} + \frac {\sqrt {2} \operatorname {atan}{\left (\frac {\sqrt {2} \left (y{\left (x \right )} - 2\right )}{2 \left (x - 1\right )} \right )}}{2} + \frac {\log {\left (2 \right )}}{2} \]