30.6.20 problem 21

Internal problem ID [7555]
Book : Fundamentals of Differential Equations. By Nagle, Saff and Snider. 9th edition. Boston. Pearson 2018.
Section : Chapter 2, First order differential equations. Review problems. page 79
Problem number : 21
Date solved : Tuesday, September 30, 2025 at 04:48:55 PM
CAS classification : [[_homogeneous, `class C`], _exact, _rational, [_Abel, `2nd type`, `class A`]]

\begin{align*} y-2 x -1+\left (x +y-4\right ) y^{\prime }&=0 \end{align*}
Maple. Time used: 0.091 (sec). Leaf size: 32
ode:=y(x)-2*x-1+(x+y(x)-4)*diff(y(x),x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-\sqrt {3 \left (x -1\right )^{2} c_1^{2}+1}+\left (-x +4\right ) c_1}{c_1} \]
Mathematica. Time used: 0.089 (sec). Leaf size: 53
ode=(y[x]-2*x-1)+(x+y[x]-4)*D[y[x],x] ==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -\sqrt {3 x^2-6 x+16+c_1}-x+4\\ y(x)&\to \sqrt {3 x^2-6 x+16+c_1}-x+4 \end{align*}
Sympy. Time used: 1.228 (sec). Leaf size: 37
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-2*x + (x + y(x) - 4)*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} + 3 x^{2} - 6 x} + 4, \ y{\left (x \right )} = - x + \sqrt {C_{1} + 3 x^{2} - 6 x} + 4\right ] \]