Model a population step by step: exponential growth and doubling time, logistic growth with a carrying capacity, and fitting a growth curve to real counts.
3 lessons, about 1 h 30 min3 simulations10 problems3 practice questionsPython in every lesson
A bacterium splits in two by fission, so a culture doubles again and again. A loop doubles the count step by step, the formula jumps to any time, and a numpy array gives every count at once. On a log axis the growth is a straight line, and the doubling time follows from the growth rate.
No population doubles for ever: food and space run short. Logistic growth slows the rate by the factor , so the count follows an S-curve and levels off at the carrying capacity K. A loop steps the growth in small time steps; the step must be small, or the answer drifts from the exact curve.
Real counts are scattered, so a model is fitted to them. For exponential growth, a straight line through against gives the growth rate as its slope, and np.polyfit finds it. For logistic growth, scipy's curve_fit searches for the r and K that make the curve pass closest to the counts.
Log in to join the discussion.
Loading…