MATH 1170: Calculus for Biologists I (Fall 2010)

advertisement
MATH 1170: Calculus for Biologists I (Fall 2010)
Lab Meets: September 7, 2010
Report due date: September 14, 2010
Section 002: Tuesday 9:40−10:30am
Section 003: Tuesday 10:45−11:35am
Lab location − LCB 115
Lab instructor − Erica Graham, graham@math.utah.edu
Lab webpage − www.math.utah.edu/~graham/Math1170.html
Lab 02
Instructions:
During the lab any necessary commands will be introduced and illustrated through examples.
Plain text appears in black inside of a plain square bracket to the left of the worksheet.
Maple commands appear in red and lines with commands begin with a red Maple prompt.
Maple output (expressions, values, and warnings) appears in blue following the commands,
within the same execution group (bracket).
Maple errors appear in pink following the commands, within the same execution group.
If you don’t want to make a text box, you can type comments to yourself or to me if you begin
the line with #.
To make a text box, click the ’T’ button on the toolbar.
Homework problems will be listed at the bottom of each lab. Please copy these problems to a
new worksheet with your full name and section number in the first line, execute required Maple
commands, and answer any questions. Your answers should be given in a short lab report
(usually 2−3 pages). The lab report should consist of the problem (as I have stated it), Maple
code used to generate data or graphs, and your answers to questions or interpretations of data
and/or graphs. You can type your answers or write them by hand on your printed out sheets.
Please do not include errors in your reports.
Each report will be due to me by the start of the next lab session.
In−class Exploration
Review: Last week, we utilized Maple’s plotting capabilities extensively to study medication
concentrations in the bloodstream and its therapeutic effect. In the process, we also
reviewed how to define functions in Maple−speak, and how varying parameter values can
change the graph of a function. In class, you learned that discrete−time dynamical systems
have an updating function that allow us to determine their solutions. Today, we’re going to
focus on understanding a little bit more about this type of system and explore what it means
to solve them. Tools we’ll need are defining functions (old), plotting (old) and iterations
(new!).
Background: The basis of this lab is the Beverton−Holt model, a classical discrete−time
model that was developed to describe the growth of harvested populations.
restart;
Let’s start with the model’s updating function, given by f(x). Remember that the updating
function is just a rule that tells us what the population of the next generation (xt 1) will be
given the current population (xt). In math−land, the model is expressed as follows:
r0
xt 1 = f xt =
xt
r0 1
1
xt
k
In Maple−land, we define f for any population x:
f:=x−>(r0*x)*(1/(1+(r0−1)*x/k));
r0 x
f := x
(1.1)
r0 1 x
1
k
Now we can specify parameters that describe the growth rate (r0) and the carrying capacity
(k), and see what f(x) looks like in a graph.
r0:=1.9; ## per generation birth rate
k:=5; ## carrying capacity (so the population doesn’t
grow forever)
r0 := 1.9
k := 5
(1.2)
FYI: Maple uses the notation x[i] to create a subscripted variable xi. From now on, this is
the notation we’ll use in the lab.
Let’s plot f(x) for x values ranging from 0 to 10. In math−land, this is equivalent to plotting
the update x[t+1] for x[t] values ranging from 0 to 10.
plot(f(x),x=0..150,labels=["x[t]","x[t+1]"]);
10
8
6
x[t+1]
4
2
0
0
50
100
150
x[t]
So, the graph of f(x) tells us that if the population is relatively large in generation t, the
population size in the next generation t+1 will be much smaller. Now, we want to explore
how to get a discrete solution of the population based on the updating function. What does
this mean? It means that starting with an initial population size, x[0], we are going to
calculate the population sizes of each subsequent generation, x[t+1], to see how the total
population changes with each passing generation.
To do this, we need to figure out how to find the solution iteratively, since Maple is way
more efficient at iterating things than a person armed with paper and a pencil is.
Step 1: Specify the initial population size x[0].
x[0]:=8;
x0 := 8
(1.3)
Step 2: Find the population sizes for the next 10 generations using the updating function f(x)
and the initial population size x[0].
To accomplish this, we need to make use of Maple’s ’for’ and ’do’ functions.
’for’ tells Maple the range of iteration values. We are going to iterate from our initial
generation ’t_init’ up to (but not including) generation ’t_end.’
’do’ tells Maple that whatever follows is what you need it to accomplish at each iteration.
’od;’ indicates the end of the (sometimes list of) commands to be done for each iteration, and
tells Maple that we want to see the end product.
t_init:=0:
t_end:=10:
for i from t_init to (t_end−1) do
x[i+1]:=f(x[i]):
od;
x1 := 6.229508197
x2 := 5.579598145
x3 := 5.289173352
x4 := 5.148138202
x5 := 5.076888413
x6 := 5.040174946
x7 := 5.021064536
x8 := 5.011064519
x9 := 5.005817334
x10 := 5.003060069
(1.4)
Step 3: Plot the solution x[t] starting from the initial population at t = 0 to t = 10. We will
first save the solution in a form that is easy to plot.
x_soln:=[seq([i,x[i]],i=0..10)]: ## saves x as a list of
ordered pairs, matching generation t to population x[t]
plot(x_soln,style=point,color="Red",labels=["t","x[t]"],
symbol=solidcircle);
Since we’re dealing with discrete time, it makes more sense to plot our solution as (discrete)
points rather than as a (continuous) line. Each point on the graph corresponds to the
population at a particular generation. Note the difference between this and the first figure,
in which we plotted a curve linking generations. Also notice the ’symbol’ option that appears
in the ’plot( )’ command.
8
7.5
7
x[t] 6.5
6
5.5
0
2
4
6
8
10
t
Now suppose we want to look at a similar harvested population y[t] that has a different
initial population size at t = 0. Following steps 1 and 2 above, we will use the same updating
function to iteratively obtain a solution for the population sizes over several generations.
Then we can compare the behavior of the two populations.
Step 1: Initial size
y[0]:=2;
Step 2: Iterate the updating function (this time evaluated at each y[i]) for the next 10
generations
t_init:=0:
t_end:=10:
for i from t_init to (t_end−1) do
y[i+1]:=f(y[i]):
od;
y0 := 2
y1 := 2.794117647
y2 := 3.532289629
y3 := 4.102763490
y4 := 4.483901158
y5 := 4.714405285
y6 := 4.845506977
y7 := 4.917480106
y8 := 4.956226268
y9 := 4.976865255
y10 := 4.987797073
(1.5)
Now let’s plot both populations, x[t] and y[t], on the same graph.
y_soln:=[seq([i,y[i]],i=0..10)]:
plot([x_soln,y_soln],style=point,color=["Red","Black"],
labels=["generation t","population size"],legend=["x[t]
","y[t]"],symbol=[solidcircle,box]);
8
7
6
population size 5
4
3
2
0
2
4
6
generation t
x[t]
8
10
y[t]
Homework Problems
Please copy the following prompts into a new worksheet and save it
as something you’ll remember.
Your Full Name:
Your Section:
Lab Number:
Useful Tip #1: Review the in−class exploration to make sure you understand what we did
and why it works. If you have questions, feel free to ask.
Useful Tip #2: Use the in−class portion of the lab as a template to aid you in the completion
of your homework problems.
Useful Tip #3: To eliminate the risk of unnecessary confusion, get in the practice of
inserting a ’restart’ command at the beginning of your assignment. Seriously. Do it.
(1) Describe what things might change a population’s growth rate.
(2) (a) Define (i.e. assign) a new r0 value that is some fraction less than 1. (Do not set r0 = 1.
)
## Feel free to use this space.
(b) Also, define k to be the same value as it was in class.
## Feel free to use this space.
(3) Define the Beverton−Holt updating function we used in class, i.e. define f(x) = (r0*x)*(1/
(1+(r0−1)*x/k)).
## Feel free to use this space.
(4) The next few exercises will go through the steps of iterating the updating function, like
we’ve done before, for a population z[t], and plotting the resulting solution.
Step 1: Define initial population size z[0] so that z[0] is smaller than k.
## Feel free to use this space.
(5) Step 2: Iterate the defined updating function for the next 30 generations for z[t],
beginning with your initial population size. (Replace the XXs with the appropriate things.)
## Define initial generation t−value here
## Define final generation t−value here
for j from XX to (XX−1) do
XX[XX+1]:=f(XX[XX]):
od;
(6) Step 3a: Define z_soln for easy plotting of z[t].
z_soln:=[seq([i,XX[i]],i=0..XX)]:
(7) Step 3b: Plot z_soln. Required: (1) Plot the solution as a sequence of points, and (2) label
your axes appropriately.
## Feel free to use this space.
(8) (a) What do you notice about the behavior of the solution z[t] as the generations
increase? What value does it seem to get closer to as t increases?
(b) How does the behavior of your z[t] solution differ from the y[t] solution we plotted in
class (the black boxes), where we had r0 = 1.9?
(9) List and describe any new Maple actions and/or commands we used today. These should
be things that Maple knows (NOT the ones we define like f(x)).
Download