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 Created by webMathematica .

Instructions

  1. Select the number of years you want to see:
  2. Initial population:

    Enter an annual growth rate as a percentage, with negative a percentage for population decreases.

    %

Do this in Mathematica

Here is how you can get this graph in Mathematica without testing input

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"];]

Ken Levasseur
Mathematical Sciences
UMass Lowell
Kenneth_Levasseur@uml.edu
UML WebMathematica Scripts
Notes on Mathematica