Delta Banner

Mathematics & Science Learning Center
Computer Laboratory

 

Applications of Differential Equations

Population Dynamics

(continued from last page...)

Your little session should have gone like this:

MatrixForm[reality]

Matrix Display of Table

Now that's a lot prettier!

Normalizing the Times

Clearly, looking over this list, the US population has "steadily" increased over the 190 year period shown. The first column of the data shows the year, which is fine, but in population analysis it is usual to consider the beginning of the data to be represented by time zero, and so on. In other words, to do a proper analysis of the data we should subtract 1790 from each of the first coordinates. This can be easily achieved with a Table command.

Look carefully at the following command. It is redefining the variable reality to have a new meaning.

reality= Table[{reality[[j,1]]-1790,reality[[j,2]]},{j,22}]

Let's carefully pick apart the command:

  • The Table command tells Mathematica that we want to build a table of values.
  • The {j,22} on the end says that the table will be built using a loop variable, j, which iterates from 1 to 22. (The 1 is implied.)
  • The {reality[[j,1]]-1790,reality[[j,2]]} tells how each element of the new table is to be formed as an ordered pair:
    • reality[[j,1]]-1790 says to take the element in the jth row, and the first column of reality, and subtract 1790. So the new first elements of each ordered pair in reality will consist of the old first elements with 1790 subtracted.
    • reality[[j,2]] says to take the element in the jth row, and the second column of reality. So the new second elements of each ordered pair in reality will consist of its old second elements with no change whatsoever.

Did you follow that? Well read it again, and do your best!

Now you're going back to Mathematica to enter this new command, but once you have, I want you to also redisplay reality with a MatrixForm command, just like you did a little earlier, to get a clear view of what it looks like.

Let's go see what you should have gotten...


Compass If you're lost, impatient, want an overview of this laboratory assignment, or maybe even all three, you can click on the compass button on the left to go to the table of contents for this laboratory assignment.
 
 

ODE Laboratories: A Sabbatical Project by Christopher A. Barker

©2009 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA
e-mail:
cbarker@deltacollege.edu