MATH 1170: Calculus for Biologists I (Fall 2010) Lab Meets: September 14, 2010 Report due date: September 21, 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 03 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 time, we looked at the Beverton−Holt model as a way of understanding a little bit more about discrete−time dynamical systems (DTDSs). We learned how to iterate solutions in Maple using a ’do’ loop. In addition, we used plotting to compare the behavior of two different populations simultaneously. Background: This week, we’ll continue to explore DTDSs by applying the cobwebbing technique to the Beverton−Holt model. We will learn how to use the updating function to help us graphically iterate the solution of a DTDS. The goal of this lab is to understand how cobweb diagrams can be useful tools in analyzing DTDSs. restart; The read( ) command will import a file (called ’cobweb’) written for the current lab. read("/u/ma/graham/public_html/Math1170/files/cobweb"): Let’s start with the updating function we used in class last week to describe the discrete−time dynamics of harvested populations, where x[t+1] = f(x[t]). f:=x−>(r0*x)*(1/(1+(r0−1)*x/k)); r0 x f := x (1.1) r0 1 x 1 k Recall that the equilibria are the solutions to the equation f(x*) = x*. Essentially, this just means that whenever x[t]= x*, there are no more changes. We can use Maple to find the equilibria of the system x[t+1] = f(x[t]). (Remember the solve ( ) command from Lab 00?) solve(f(x)=x,x); 0, k (1.2) If we specify the growth rate (r0) and the carrying capacity (k), we can do more stuff with this information. r0:=1.9; ## per generation birth rate k:=5; ## carrying capacity (so the population doesn’t grow forever) r0 := 1.9 k := 5 (1.3) Let’s say we wanted to do a cobwebbing analysis on this system. Nonlinear functions, like the one we have, can be pretty hard to graph by hand. So, it’s convenient to use Maple to plot both the updating function and the diagonal. The ’gridlines’ option makes things easier to see (and will be helpful in your homework). diag:=x−>x: plot([diag(x),f(x)],x=0..7,color=["DarkCyan", "LimeGreen"],labels=["x[t]","x[t+1]"],gridlines=true); 7 6 5 4 x[t+1] 3 2 1 0 0 1 2 3 4 5 6 7 x[t] Notice where the two curves in the graph intersect. These are the equilibrium points we solved for earlier (at 0 and k=5). In the homework, you’ll do cobwebbing by hand, but we’ll visualize how it’s carried out with the current example using the file we imported at the beginning. (Note: You will NOT need this file for the homework; it’s only to help you get a better idea of what it means to create a cobweb diagram.) We will create a cobweb diagram for the discrete system by iterating from t=0 through t=8, with a starting population size(initial condition) of 1. t_init:=0: t_end:=8: x_start:=1: cobweb_BV ( ) was written to take the 2 Beverton−Holt model parameters (r0 and k), our iteration limits and an initial condition to create a cobweb diagram animation and a graph of the corresponding solution side by side. cobweb_BV(r0,k,t_init,t_end,x_start); To play the animation, click anywhere within the cobweb diagram region on the left, then click the ’play’ button in the ’Animation’ toolbar at the top of the document window. The big red dot is our starting point x[0]=1. Cobweb animation for Beverton− Holt model 7 Discrete solution of Beverton−Holt model versus time 7 6 6 5 5 4 4 x[t+1] x[t] 3 3 2 2 1 1 0 0 0 1 2 3 4 5 6 7 x[t] 0 1 2 3 4 5 6 7 8 t How to make a cobweb diagram (with paper and pencil) To create a cobweb diagram: (1) Plot the updating function x[t+1] = f(x[t]) versus x[t] so that x[t+1] is on the y−axis, and x[t] is on the x−axis. (2) Plot the diagonal function x[t+1] = x[t] on the same graph. This is essentially the line y = x with a different name. (3) Choose an initial condition x[0]. Place your pencil at the point x[0] on the x−axis. (4) With your pencil (and a ruler), draw a vertical line straight from x[0] to the updating function (can be either above or below your starting point). (5) From this new point, draw a horizontal line straight over to the diagonal (can be either to the left or right). (6) From the point you reached in step (5), draw a vertical line straight to the updating function. (7) Repeat steps (5) and (6) as necessary, alternating horizontal and vertical lines. To sketch the discrete solution from your cobweb, it helps to connect any vertical lines you’ve drawn to the x−axis. Where they land on the x−axis and the order in which they were drawn corresponds to the solution x[t] at a particular time t. Things to keep in mind: −−Once you’ve graphed the updating function, you should only have to draw straight lines. −−You will always start on the x−axis. Lab 03 Homework Problems Please copy the following prompts into a new worksheet and save it as something you’ll remember. Your Full Name: Your (registered) Lab Section: 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: Remember that when you re−open a saved .mw file, any blue output that shows up doesn’t mean that Maple remembers the commands you executed before. You will ALWAYS need to re−execute everything from the beginning if you plan to use previously defined variables to write new code. Useful Tip #3: To eliminate the risk of unnecessarily losing all of your work, save it early and often. Useful Tip #4: To eliminate the risk of unnecessary confusion, continue the practice of inserting a ’restart’ command at the beginning of your assignment. Seriously. Do it. This assignment will give you some practice with cobwebbing. It is based on the discrete logistic growth equation, for which you will complete a few different cobweb diagrams by hand that correspond to different values describing the population’s growth rate. FYI: It’s the predecessor to the Beverton−Holt model we’ve been exploring in class. Note: You will need to print your graphs before you can complete the assignment (to ’lcb115’ if you’re still in class). I still want to see any Maple code you write to complete the exercises. (1) Define the updating function g(x) = r*x*(1−x) for the discrete logistic growth equation. ## Feel free to use this space. (2) (a) Do some math (by hand) to solve for the equilibria of the system x[t+1] = g(x[t]). I want to see your work! Feel free to use the space below to write your calculations. (b) Now use Maple’s solve command to check your results. ## Feel free to use this space. (3) Define the diagonal function diag(x) = x. ## Feel free to use this space. (4) (a) Graph 1: Set r =0.8, and plot g(x) and diag(x) for x values between 0 and 1 on the same graph. Required: [1] Label your axes appropriately; [2] include grid lines in your plot; [3] include a title in your plot command that includes the phrase "Graph 1" somewhere. ## Feel free to use this space for graph 1. (b) After printing out graph 1, start with the initial condition x[0] = 0.5, and draw a cobwebbing diagram to see where the population will end up over time. (5) (a) Clear your ’r’ value (by executing the r:=’r’; code) to eliminate the possibility of confusion. ## Feel free to use this space. (b) Graph 2: Now set r =2.5 and plot g(x) and diag(x) for x values between 0 and 1 on the same graph. Required: [1] Label your axes appropriately; [2] include grid lines in your plot; [3] include a title in your plot command that includes the phrase "Graph 2" somewhere. ## Feel free to use this space for graph 2. (c) After printing out graph 2, start with the initial condition x[0] = 0.5, and draw a cobwebbing diagram to see where the population will end up over time. (6) (a) Clear your ’r’ value again. ## Feel free to use this space. (b) Graph 3: Now set r =3.5, and plot g(x) and diag(x) for x values between 0 and 1 on the same graph. Required: [1] Label your axes appropriately; [2] include grid lines in your plot; [3] include a title in your plot command that includes the phrase "Graph 3" somewhere. ## Feel free to use this space for graph 3. (c) After printing out graph 3, start with the initial condition x[0] = 0.5, and draw a cobwebbing diagram to see where the population will end up over time. (7) What differences do you notice among the populations within your 3 cobwebs? (8) Choose your favorite cobweb diagram from those that you’ve drawn above (pick only one), and sketch by hand the corresponding solution of x[t] versus t based on the information in your diagram for at least 5 iterations. Sketch this graph on a separate set of axes, labeled appropriately, and clearly indicate which cobweb you’ve chosen. (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)).