58.5.35 problem 39

Internal problem ID [14629]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 2, section 2.3 (Linear equations). Exercises page 56
Problem number : 39
Date solved : Thursday, October 02, 2025 at 09:44:46 AM
CAS classification : [_Riccati]

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