Lab 2:  Learning to write and use functions

Introduction

In the introduction to Mathematica we discussed how to write functions.  Here, we will use this information to explore the exponential growth model.  Before proceeding, review the previous lab and make sure you understand the meaning of the underscore after variable names (e.g., x_) and the difference between = and := when defining functions.

At any future point in time, the number of individuals predicted under exponential growth is given by the general solutions for a:

Discrete-time model:  		n0 (((1 + r))^t)
Continuous-time model: 	n0 (e^( r t))

      
Note that these are functions of three things: t, r, n0.

(1) Write the functions in Mathematica language, using "nd" as the variable name to describe the number of individuals in the discrete-time model and "nc" in the discrete-time model  
(2)  What are the population sizes under the two models with the following parameters and starting condition?
	t=20
	r=0.2
	n0=2
(3)  Which model has the higher population size and by how much?
(4)  Plot the two functions from t=0 to 20 for r=0.2 and n0=2.  Call these plot1 and plot2 and use Show[plot1, plot2] to present them together.

If you wish, you may make one of the curves dashed by adding:
	, PlotStyle ->Dashing[{0.01}]
in your Plot command, right before the final "]".  Alternatively, you can make a curve in colour by adding:
	, PlotStyle ->RGBColor[1,0,0]
in your Plot command, right before the final "]".  Look up the RGBColor command to see what color this would be and how to get different colors.

You can work in your study group.  After you are done, show your TA your group's answers.

Working area