12.3.26 problem 27

Internal problem ID [1603]
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 : 27
Date solved : Saturday, March 29, 2025 at 11:06:53 PM
CAS classification : [_quadrature]

\begin{align*} y^{\prime }&=a y-b y^{2} \end{align*}

With initial conditions

\begin{align*} y \left (0\right )&=\operatorname {y0} \end{align*}

Maple. Time used: 0.065 (sec). Leaf size: 25
ode:=diff(y(x),x) = a*y(x)-b*y(x)^2; 
ic:=y(0) = y0; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = \frac {a \operatorname {y0}}{\left (-\operatorname {y0} b +a \right ) {\mathrm e}^{-a x}+\operatorname {y0} b} \]
Mathematica. Time used: 0.731 (sec). Leaf size: 27
ode=D[y[x],x]==a*y[x]-b*y[x]^2; 
ic=y[0]==y0; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {a \text {y0} e^{a x}}{b \text {y0} \left (e^{a x}-1\right )+a} \]
Sympy. Time used: 0.459 (sec). Leaf size: 41
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
y = Function("y") 
ode = Eq(-a*y(x) + b*y(x)**2 + Derivative(y(x), x),0) 
ics = {y(0): y0} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {a e^{a \left (x + \frac {\log {\left (\frac {b y_{0}}{- a + b y_{0}} \right )}}{a}\right )}}{b \left (e^{a \left (x + \frac {\log {\left (\frac {b y_{0}}{- a + b y_{0}} \right )}}{a}\right )} - 1\right )} \]