Mathematics & Science
Learning Center |
|||
Applications of Differential EquationsPopulation Dynamics(continued from last page...) Your latest session should have gone like this:
QuantityMagnitude[CountryData["UnitedStates", {"Population", 2010}]] So now we have the population given as a unitless number. Good! Next we're going to pull all of the US census data into a list called uscensus starting from the very first census up to the last one in 2010. The Wolfram database keeps track of more population information than just this, so what we'll do is extract only their data for actual census years, i.e. years that are multiples of 10 starting in 1790 and ending in 2010. We'll put this data into a table of ordered pairs with the year in the first position of each pair and the population in the second position. We can achieve this with the following command: uscensus = Table[{k, QuantityMagnitude[CountryData["UnitedStates", {"Population", k}]]}, {k, 1790, 2010, 10}]Read the above command through carefully and try to grasp what it is doing. The first entry inside the Table command is an ordered pair enclosed by braces. The first entry in the brace is k, which is our index for building the table, and it will denote the year. The second entry in the pair is the much longer command we tried earlier, (at the top of this window, in fact!) But instead of specifying 2010 like we did above we have specified that we want the population for the year k. After we close out the braces for the ordered pair we finish the command by specifying the parameters for our table's index, k. {k, 1790, 2010, 10} tells the table to start with a k value of 1790, end with a k value of 2010, and make jumps of 10. Issue the command, then return here. Let's go see what you should have gotten... |
|||
ODE Laboratories: A Sabbatical Project by Christopher A. Barker ©2017 San Joaquin Delta College, 5151 Pacific Ave., Stockton, CA 95207, USA e-mail: cbarker@deltacollege.edu |