Tanggal :September 22, 2020

py32. Logistic Growth in Python

Spread the love

Logistic growth of fisheries, or other populations, will go towards a Carrying Capacity. The growth will start exponentially and is S-shaped.

For a specific rate of growth, and Carrying Capacity, the Population is shown.

The vertical line shows the maximum derivative, that is where the maximum growth occurs.

# ex32.py
from __future__ import print_function, division
import numpy as np
import matplotlib.pyplot as plt

r = .25 # growth rate / yr
K = 100 # carrying capacity
t = 40 # number of years
num = np.zeros(t+1)
num[0] = 1
for i in range(t):
num[i+1] = num[i]+r*num[i]*(1-num[i]/K)
plt.plot(range(t+1),num, 'b')
plt.title('Growth rate: 0.25, Carrying Capacity = 100')
plt.axvline(np.argmax(np.diff(num)), color = 'k' )



Leave a Reply

Your email address will not be published. Required fields are marked *