Exponential Growth Model | ![]() |
This webMathematica script illustrates an exponential population model with fixed growth rate. Given an initial population, p, and growth rate, g%, we assume that the population in the following year will be .
p0 = Input["Initial Population?"];
gr = Input["Growth Rate (as a percentage)?"];
years = Input["Number of years"];
ListPlot[Map[{#, p0 (1+gr/100)^#} &, Range[0, years]]]
and a bit more complex if you test input:
p0 = Input["Initial Population?"];
gr = Input["Growth Rate (as a percentage)?"];
years = Input["Number of years"];
If[IntegerQ[years] && (years > 5) && (years < 1000) && NumberQ[gr] &&
NumberQ[p0] && (Im[p0] == 0) && (Im[gr] == 0),
ListPlot[Map[{#, p0 (1+gr/100)^#} &, Range[0, years]]],
Print["Bad input data"];]