12.3.8 problem 9

Internal problem ID [1585]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. separable equations. Section 2.2 Page 52
Problem number : 9
Date solved : Saturday, March 29, 2025 at 11:00:39 PM
CAS classification : [_separable]

\begin{align*} y^{\prime }&=\left (x -1\right ) \left (y-1\right ) \left (y-2\right ) \end{align*}

Maple. Time used: 0.012 (sec). Leaf size: 29
ode:=diff(y(x),x) = (x-1)*(y(x)-1)*(y(x)-2); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {-2+c_1 \,{\mathrm e}^{\frac {x \left (x -2\right )}{2}}}{c_1 \,{\mathrm e}^{\frac {x \left (x -2\right )}{2}}-1} \]
Mathematica. Time used: 0.284 (sec). Leaf size: 56
ode=D[y[x],x]==(x-1)*(y[x]-1)*(y[x]-2); 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {2 e^x-e^{\frac {x^2}{2}+c_1}}{e^x-e^{\frac {x^2}{2}+c_1}} \\ y(x)\to 1 \\ y(x)\to 2 \\ \end{align*}
Sympy. Time used: 3.731 (sec). Leaf size: 92
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((1 - x)*(y(x) - 2)*(y(x) - 1) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \frac {2 e^{2 x} - e^{2 C_{1} + x^{2}} - \sqrt {e^{2 C_{1} + x^{2} + 2 x}}}{e^{2 x} - e^{2 C_{1} + x^{2}}}, \ y{\left (x \right )} = \frac {2 e^{2 x} - e^{2 C_{1} + x^{2}} + \sqrt {e^{2 C_{1} + x^{2} + 2 x}}}{e^{2 x} - e^{2 C_{1} + x^{2}}}\right ] \]