MATH 1170: Calculus for Biologists I (Fall 2010) Lab Meets: September 21, 2010 Report due date: September 28, 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 04 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 saw how to use Maple as a tool for cobwebbing with a nonlinear discrete−time system. Background: Today, we’ll focus on developing an extension to the selection model introduced in the text. The goal of this lab is to see how we can go from model development to informal analysis using Maple. restart; read("/u/ma/graham/public_html/Math1170/files/cobweb"): ## useful file we’ll need Let’s build a model of selection to include both mutation and reversion. Suppose we have a wild type, b[t], and a mutant, m[t], population. Assume the wild type have a per capita production rate of r and the mutants a production rate of s. Also, a fraction u of wild type offspring can mutate into the mutant type, and a fraction v of mutant offspring can revert back. To set up the model, we first need to determine expressions for b[t+1] and m[t+1]. b[t+1] = b[t] births −b[t] mutation + m[t] reversion m[t+1] = m[t] births −m[t] reversion + b[t] mutation Using this construct, we can start plugging in variables and parameters. b[t+1] = r*b[t] − u*r*b[t] + v*s*m[t] m[t+1] = s*m[t] −v*s*m[t] + u*r*b[t] Now that we have the preliminaries, we can tell Maple to do the rest. Our ultimate goal is to derive a model of selection describing the discrete−time dynamics of the mutant fraction of the entire population. First, we’ll define B = b[t+1] and M = m[t+1] as expressions to use later. B:=r*b − u*r*b + v*s*m; M:=s*m − v*s*m + u*r*b; B := r b u r b v s m M := s m v s m u r b (1.1) The next step is to define the new fraction P = p[t+1] of the population that is made up of mutants. Recall that this fraction is simply M/(M+B). P:=simplify(M/(M+B)); sm vsm urb P := (1.2) sm rb Notice the P is in still in terms of b and m. To fix this, we need to use the mutant fraction p = m/(m+b) to figure out what m should be in terms of p and then plug m into P. To make sure things cancel as they should, we’ll use the simplify command. We’ll name the resulting function f(p), and see what it looks like. f:=p−>simplify(eval(P,m=solve(p=m0/(m0+b),m0))): ## ’m0’ is a place holder for ’m’ f(p); sp vsp urp ur (1.3) sp rp r Notice that f(p) no longer has m or b in it. That means we’ve successfully built ourselves a useful updating function! As you know, there are several things we can do with discrete systems. As always, we can determine the equilibria of the system, by solving the equation f(p*)=p*. solve(f(p)=p,p); 1 1 s vs ur r (1.4) 2 s r s2 1 2 2 v s2 1 s s r s2 2 v s2 2sur vs ur 2sur 2sr v2 s2 2vsur 2vsr u2 r2 2 u r2 r2 , v2 s2 2vsur 2vsr u2 r2 2 u r2 r2 r 2sr Yikes! Let’s define some parameters to see if we can make sense of this. r:=1.5: ## wild type production s:=2: ## mutant production u:=0.2: ## wild type−to−mutant mutation v:=0.1: ## mutant−to−wild type reversion One more time... solve(f(p)=p,p); 0.7745966692, 0.7745966692 (1.5) Naturally, we’ll throw out the negative equilibrium, as it doesn’t make sense in the context of populations. This says that the equilibrium state of this system is one in which the mutant type makes up almost 78% of the population. Let’s see what both populations do over time. (Remember that b[t] = 1−p[t], so it’s enough to see what happens to the mutants alone.) We’ll use another function in the cobweb file called iterplot ( ), which will iterate our updating function (using the ’do’ loop we learned how to do a couple of weeks ago) from t_init to t_end with a starting mutant proportion of 0.05. t_init:=0: t_end:=15: p_start:=0.05: iterplot(f,t_init,t_end,p_start); 0.7 0.6 0.5 solution 0.4 0.3 0.2 0.1 0 5 10 15 time Notice that even if the mutant population is only 5% of the total population at the beginning, it will start to dominate within 5 years, given the parameter values we used. Also, the proportion p[t] approaches what looks to be about 0.775 as time increases, which suggests that the equilibrium might be stable. Let’s verify this using a cobweb diagram produced by cobweb_mut ( ) and an initial condition that starts near our equilibrium point, say at 0.75. p_start:=0.75: cobweb_mut(f,t_init,t_end,p_start); 0.79 0.78 0.77 p[t+1] 0.76 0.75 0.74 0.73 0.73 0.74 0.75 0.76 0.77 0.78 0.79 p[t] What if we changed some of our parameters? For instance, what if we redefined v to be 0.3, and kept everything else the same as before? This requires that we redefine f(p). r:=1.5: s:=2: u:=0.2: v:=0.3: f:=p−>simplify(eval(P,m=solve(p=m0/(m0+b),m0))):f(p); 0.2000000000 11. p 3. p 3. Again, we solve for the equilibria... solve(f(p)=p,p); 1.271779789, 0.4717797887 ...and see what the solution looks like. iterplot(f,t_init,t_end,.3); (1.6) (1.7) 0.46 0.44 0.42 0.40 solution 0.38 0.36 0.34 0.32 0.30 0 5 10 15 time It appears that mutants don’t fare as well when a larger fraction of them revert to a wild type, with an equilibrium fraction of about 0.47. Lab 04 Homework Problems Please copy this entire section 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. Useful Tip #2: Read through the assignment to get a clear idea of what’s being asked of you. When you’ve finished your assignment, review it to make sure you’ve completed each exercise and answered each question. Useful Tip #3: Save your work early and often. Useful Tip #4: Continue the practice of inserting a ’restart’ command at the beginning of your assignment. In this assignment, you’ll continue to explore the selection/mutation/reversion model we developed in class. Again, this assignment will require a hybrid of Maple and paper/pencil work. You may want to read through the assignment first to determine an optimal time to print your work. (You can always write in the answers to any follow−up questions with pencil.) (1) Given the system we began with in class (with the b[t] and m[t] populations), suppose r = s. What does this mean biologically? (2) Figure out what the updating function f(p) for the proportion of mutants should be based on this assumption, and define it for Maple. (You can skip straight to dealing with p, instead of m and b first. Use scratch paper as needed.) ## Feel free to define f(p) in this space. (3) Solve for the equilibrium of the system p[t+1]=f(p[t]), and assign a name to the result. ## equilibrium name here := ## solve command here (4)(a) How can having an equilibrium value p* > 0.5 be interpreted biologically? (b) Suppose you happen to know that in order to end up with an equilibrium value greater than 0.5, this system requires that u > v. (If you wanted, you could verify this mathematically.) How would you interpret this result biologically? (c) Choose and assign appropriate u and v values that satisfy the inequality in part (b). Important: Keep in mind that u and v are positive fractions (i.e. less than 1)! ## Feel free to use this space to define u and v. (d) What value does your equilibrium take on now? ## write your equilibrium name here, followed by a semicolon (5)(a) Define the diagonal function diag(p) = p, and plot both diag(p) and f(p) on the same set of axes, for p values between 0 and 1. Required: [1] Label your axes appropriately; [2] create a legend to distinguish between the diagonal and the updating function (refer back to previous labs, or use the help index, if you’re unsure of how to do this). Optional: Include grid lines in your plot to aid in part (b). ## Define diagonal function here. ## Put plot command here. (b) Print out your graph, and choosing an initial condition smaller than your equilibrium, draw a cobweb diagram (by hand!) to guess its stability. On the same graph, choose another initial condition, this time larger than your equilibrium, and repeat the cobweb process. Does your equilibrium appear to be stable or unstable? (c) Sketch, by hand and on a new graph, the solutions versus time to the two cobwebs you drew in the previous exercise. These two solutions should be on the same set of axes. (6)(a) Suppose we had a special case in which r = s and v =u. What would this mean biologically? (b) What do you think would happen to the proportions of both the wild and mutant types in the end? Explain. (c) Repeat the applicable steps you completed for the first part of this assignment to verify your answer for part (b). In particular: (i) Restart! ## Feel free to use this space. (ii) Figure out what the new updating function f(p) should be under the current assumptions, and define it in Maple. ## Feel free to use this space. (iii) Assign an appropriate value to any as−yet−undefined parameters, i.e. choose a value for any letter that’s not p in your updating function. ## Feel free to use this space. (iv) Solve for the equilibrium of the current system. ## Feel free to use this space. (v) Determine its stability via cobwebbing (using 2 different initial conditions, as before). This will require a printed graph of the appropriate functions. Clearly indicate/state whether the equilibrium is stable or unstable. ## Feel free to use this space. (7) List and describe any new Maple actions and/or commands you learned today. These should be things that Maple knows (NOT the ones we define like f(x)).