19.1.27 problem 27

Internal problem ID [4239]
Book : Advanced Mathematica, Book2, Perkin and Perkin, 1992
Section : Chapter 11.3, page 316
Problem number : 27
Date solved : Tuesday, September 30, 2025 at 07:08:13 AM
CAS classification : [[_homogeneous, `class C`], _exact, _rational, [_Abel, `2nd type`, `class A`]]

\begin{align*} \left (x +y-1\right ) y^{\prime }&=x -y+1 \end{align*}
Maple. Time used: 0.181 (sec). Leaf size: 28
ode:=(-1+x+y(x))*diff(y(x),x) = x-y(x)+1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-c_1 x -\sqrt {2 c_1^{2} x^{2}+1}+c_1}{c_1} \]
Mathematica. Time used: 0.081 (sec). Leaf size: 47
ode=(x+y[x]-1)*D[y[x],x]==(x-y[x]+1); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\sqrt {2 x^2+1+c_1}-x+1\\ y(x)&\to \sqrt {2 x^2+1+c_1}-x+1 \end{align*}
Sympy. Time used: 0.868 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x + (x + y(x) - 1)*Derivative(y(x), x) + y(x) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = - x - \sqrt {C_{1} + 2 x^{2}} + 1, \ y{\left (x \right )} = - x + \sqrt {C_{1} + 2 x^{2}} + 1\right ] \]