Lesson 6 of 15

Logistic Growth

Logistic Growth

Pure exponential growth is unrealistic — populations cannot grow forever. The logistic equation adds a carrying capacity KK:

dydt=ry(1yK)\frac{dy}{dt} = r \cdot y \cdot \left(1 - \frac{y}{K}\right)

  • When yKy \ll K: growth is approximately exponential (1y/K11 - y/K \approx 1)
  • When y=Ky = K: growth stops (1y/K=01 - y/K = 0)
  • When y>Ky > K: growth is negative (population declines toward KK)

Exact Solution

y(t)=K1+Ky0y0erty(t) = \frac{K}{1 + \dfrac{K - y_0}{y_0}\, e^{-rt}}

The solution forms an S-shaped curve (sigmoid), starting slow, accelerating, then leveling off at KK.

Applications

  • Population ecology: bacteria, fish stocks, human populations
  • Epidemiology: spread of diseases before herd immunity
  • Technology adoption: product diffusion models (Bass model)
  • Neural networks: sigmoid activation function

Equilibria

The logistic equation has two equilibria:

  • y=0y = 0: unstable (any small population grows)
  • y=Ky = K: stable (perturbations return to carrying capacity)

Your Task

Implement logistic(r, K, y0, t_end, n) using Euler's method.

Pyodide loading...
Loading...
Click "Run" to execute your code.