64.5.35 problem 39

Internal problem ID [13269]
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 : Wednesday, March 05, 2025 at 09:32:37 PM
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: 31
ode:=diff(y(x),x) = (1-x)*y(x)^2+(2*x-1)*y(x)-x; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (2 x -2\right ) {\mathrm e}^{x}-c_{1}}{\left (2 x -4\right ) {\mathrm e}^{x}-c_{1}} \]
Mathematica. Time used: 0.198 (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.322 (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}} \]