Course 5.1Lesson 1 of 3
A bacterium splits in two by fission, so a culture doubles again and again. A loop doubles the count step by step, the formula
Try the code and the simulations beside the lesson.
In the chapter How do Organisms Reproduce? you met binary fission. A bacterium copies its DNA, grows, and splits into two cells. Each new cell does the same. If a culture has cells and they all split every minutes, the counts go
This is exponential growth: the count is multiplied by the same number in each equal step of time. In this lesson you compute it three ways.
A loop does exactly what the cells do. One pass of the loop is one doubling:
It prints , and cells at , and minutes. The line N = 2 * N replaces the old count with a new one, twice as large.
After doublings the count is . If the doubling time is , then after a time there have been doublings:
In Python, ** is the power: 500 * 2 ** (180 / 20) gives cells after hours. The formula also works between the steps. After minutes, 2 ** (30 / 20) is about , so the culture holds about cells.
np.arange(0, 181, 20) makes the times minutes. The formula then works on the whole array at once:
There is no loop in your code, but numpy loops over the array for you. This is the form you need for a plot.
On an ordinary, linear axis, exponential growth hides its start. The first hour looks flat, and the last hour fills the plot. A log axis spaces , and equally. On it, every doubling climbs the same height, so the curve becomes a straight line.
In matplotlib, one line changes the axis: plt.yscale("log"), or ax.set_yscale("log") for one panel of a figure. A straight line on a log axis is the quickest test of exponential growth in real data.
Biologists often give a growth rate instead of a doubling time. Then the growth is written with the number :
The two forms agree when , that is
For a doubling time of minutes, per minute, or per hour. In numpy, np.log is the natural logarithm, , and np.exp is the power of .
The program grows the culture with a loop, checks the formula, and plots the counts on both kinds of axis.
N = N + 2 adds two cells each step. Doubling is N = 2 * N.^ for a power. In Python, 2 ^ 3 is a bitwise operation and gives 1. The power is 2 ** 3.np.log10 for . The doubling time needs the natural log: np.log(2) is , but np.log10(2) is .N = 2 * N follows the doublings; N0 * 2 ** (t / T) jumps to any time, for a number or a numpy array.plt.yscale("log"), exponential growth is a straight line.Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
2 ** (90 / 30) give, and what does it mean for a culture?N = 500 * 2 ^ (t / 20). What goes wrong?Every lesson is open to read. Enrolling also lets you:
Log in to join the discussion.
Loading…
This lesson is free to read. Enroll free to keep your place and take the tests.