One subject that crosses many disciplines is that of modeling population
growth and or decay. Biologists are interested in such models in terms of
modeling species interactions, economists are interested in such models for
use in economic forecasting (as we saw in a previous lesson on compound
interest), bio- and chemical-engineers are interested in such models for
predicting the rates of certain reactions. Furthermore, the same
mathematical model can be used to describe radioactive decay, diffusion of
a chemical across a thin membrane, the rate of cooling of objects, and even
the spread of disease.
Let's look at a simple population growth model. Let P(t) be the size of
the population at a given time t. Let b and d be the birth and death
rates per unit time, respectively. It seems reasonable that the change in
the population over time would be proportional to the number of births
minus the number of deaths over time. Or
DP/Dt is proportional to (b-d) Dt
where
D
signifies a discrete change. If one sets these two
expressions equal and takes the limit as
Dt goes to 0 (remember
your basic calculus), we can write this relationship mathematically as,
dP(t)/dt = (b-d) t
If one integrates this equation, one can find a solution for the population
at a given time as a function of the number of births and deaths,
P(t) = P(0) e^((b-d)t)
where P(0) denotes the population at time equal to zero (i.e., whenever
you start measuring it).
As we can easily see, the population will grow at an exponential rate if
b-d > 0, decay at an exponential rate if b-d < 0, or stagnate if
b-d = 0.
Let's assume we have a small town which, because of its scenic beauty and
appeal to rugged outdoors types, has been experiencing steady growth over the
last several years. We can plot the town's growth using Mathematica's ability to
graph sets of tabulated data.
Using emacs, create a file called data.m containing the following data
points recorded from census data over the last ten years. The numbers in the
left column signify the year and the number in the right column signify the
population at a given year.
data =
{{0, 1000.00},
{1, 1221.40},
{2,1491.82},
{3,1822.19},
{4,2225.54},
{5,2718.28},
{6,3320.12},
{7,4055.20},
{8,4953.03},
{9,6049.65}};
The data was created in Mathematica by evaluating equation (7.3) with an
initial population of P(0) = 1000 and a birth minus death constant of
.2 .
Now you can read this information into Mathematica with
<<data.m
The ListPlot function will plot from tabulated data in this
form. Try
ListPlot[data];
You will notice that Mathematica does not ``connect the dots,''
for you. Whenever you plot a set of tabulated data,
Mathematica automatically defaults to this value. Instead we could
have Mathematica find the ``best possible'' smooth curve through the data
points and plot that. How one finds this ``best
possible'' curve through the data points is an important topic which
we will revisit in another lesson. For now we will just connect the
data points using straight lines between each point. Try the following:
ListPlot[data, PlotJoined-> True];
As you might guess, he PlotJoined option tells the Mathematica
ListPlot function whether or not the data points should be joined with a
straight line.