MATH 1170: Calculus for Biologists I (Fall 2010) Lab Date: August 24, 2010 Report due date: none this week 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 00 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. Preliminaries: There are two kinds of math speak in Maple: ’Maple input’ and ’2D Math.’ When you open Maple, the default is 2D Math, which you may feel free to use. Anything you type in 2D Math will appear in italicized black text instead of the red Maple input font. I will use the red input font for the lab. To make this your default, go to Tools −−> Options −−> Display, change the ’Input display’ option to ’Maple Notation’; then on the ’Interface’ tab, change the ’Default format for new worksheets’ option to ’Worksheet’. To finish, press the ’Apply Globally’ button. Now, whenever you create a new execution group (press the ’[>’ button in the toolbar), whatever you type will be red. Try it. Execute commands in Maple by clicking next to the > prompt and pressing ’Enter.’ (Note: pressing ’Shift’ + ’Enter’ together moves the cursor to a new line within an execution group. Use this when you want to execute multiple things all at once.) Begin each new Maple worksheet you create with the ’restart’ command. This clears Maple’s memory. restart; The ’;’ (semi−colon) and ’:’ (colon) are Maple staples. Each command line should always end in one or the other. Note the difference between them. Pi; Pi: Common arithmetic operations are fairly straightforward here. 2+5; 2−5; 2*5; 2/5; 2^5; Parentheses group operations together, as you would expect. HOWEVER, square brackets and curly braces do not. So, we have to use parentheses whenever we want to combine any operations. 1+(2^(8/(1*2))); 1+[2^[8/[1*2]]]; 1+{2^{8/{1*2}}}; The good thing about Maple is it performs symbolic algebra. This means that it can do math with things that are not numbers, like ’m’. m+m; b*(b/m); What if we wanted to assign a number to ’m’ and ’b’? To set ’m’ equal to 5, we use ’:=’ and not simply ’=’. Notice the difference. m=5; m; ## This recalls the value (if any) in Maple’s memory. m:=5; m; b:=3; What about functions? Recall that functions have an input (independent variable, ’x’) and usually an output (dependent variable, ’f(x)’). Let’s define a line in slope−intercept form, where ’m’ is the slope and ’b’ is the intercept, and store our line as the function ’f(x)’. f:=x−>m*x+b; When defined this way, functions start to look a lot like the ones we’re used to. f(x); ## Check to make sure this is what we wanted. Say we want to know when our function hits a value of 30. Let’s see if we can calculate this. solve(f(x)=30,x); We can plot our newly defined function ’f(x)’ too, complete with labels and color. plot(f(x),x=0..10,labels=["x","y"],color="Crimson"); To plot ’f(x)’ and a horizontal line ’g(x)=30’, we can use the following plot command−−with ’[f (x),30]’−−and specify a couple of new attributes. You can edit lots of things within your plots by right−clicking in the plot region. plot([f(x),30],x=0..10,labels=["x","y"],color=["Crimson", "Gray"],style=[line,line],legend=["f(x)","g(x)"]); Where does it look like the two lines cross? If you ever have questions on a particular command in Maple, the Help menu is a great place to start. help("colornames") ## pick your favorite color Homework problems *Note: You do NOT have to hand in the following problems. They are merely to get you acquainted with working in Maple. That said, I strongly recommend that you do them. In the future, this paragraph will disappear. Please copy the following prompts into a new worksheet and save it as something you’ll remember. Your Full Name: Your Section: Lab Number: The following problems are based on a common model applied to biology: r*x*(1−(x/K)). All of the commands you will need have been introduced above. (1) Assign a value of 0.1 to r. ## Replace this text (## too) with a command that sets r= 0.1 and execute. (2) Assign a value of 500 to K. ## Replace this text with a command that sets K=500. (3) Define the function g(x) = r*x*(1−(x/K)). ## Put your command for defining g(x) here. (4) Find the value(s) of x for which g(x)=0. ## Write a command that solves g(x)=0 for x here. (5) Evaluate g at the value(s) Maple gave you in problem (4). What answer(s) did you get? ## 1st value ## 2nd value (if any) (6) Plot the function g(x) for values of x between 0 and 500, specifying axes labels and your favorite color from above. ## Type plot command here. (7) Use the Help command/menu to explore one other topic or command we’ve used thus far that you’d like to know more about. help("insert_topic_here");