MATH 1170: Calculus for Biologists I (Fall 2010) Lab Meets: October 5, 2010 Report due date: October 19, 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 06 General Lab Instructions In−class Exploration Review: Last time, we explored average and instantaneous rates of change using the slopes of secant and tangent line approximations to a function. In doing so, we came across the idea of a limit in the context of a derivative. Background: This week, we will review and further explore the idea of secant and tangent lines and what they mean with respect to functions and their derivatives. We will also see how graphs of functions and their derivatives relate to each other. restart; Let’s define the function f(x) that we’ll focus on today and plot it for x values from 0 to 5. f:=x−>(1/4)*x^4−(8/3)*x^3+(19/2)*x^2−12*x+10; plot(f(x),x=0..5,labels=["x","f(x)"]); 1 4 8 3 19 2 f := x x x x 12 x 10 4 3 2 10 9 f(x) 8 7 6 0 1 2 3 4 5 x To see what the derivative of f(x) looks like, we follow the following process: Step 0: Recall that the derivative of f(x) ... is exactly equal to the slope of the tangent line at x, which is exactly equal to the limit of the slopes of every conceivable secant line you could draw as the distance from x decreases to zero, which is exactly equal to the instantaneous rate of change at the point x. We will proceed with the "limit of the slopes of every conceivable secant line you could draw as the distance from x decreases to zero" approach. Step 1a: Compute and define the general slope of the secant line that connects the points (x,f(x)) and (x+h, f (x+h)) as a function of h. (Pretend that h = x, like you may be used to.) We consider this slope to be general because it is true for ANY value of h. sec_slope:=h−>(f(x+h)−f(x))/(x+h−x); f x h f x sec_slope := h (2.1) x h x Step 1b: See what the slope looks like in its general form. sec_slope(h); 1 8 19 1 4 8 3 19 2 x h 4 x h 3 x h 2 12 h x x x 4 3 2 4 3 2 (2.2) h Step 2: Take the limit as h goes to 0 of sec_slope(h). There are two ways to do this. [1] Use the limit( ) command you learned last week, or [2] Evaluate sec_slope(0). Method 1: limit(sec_slope(h),h=0); Notice that all the h terms magically disappeared, and we’re left with an expression in terms of x. x3 12 8 x2 19 x (2.3) Method 2: sec_slope(0); Error, (in sec_slope) numeric exception: division by zero Oops! It seems Method 2 isn’t exactly what we wanted, not yet at least. Let’s see if we can make it work by using simplify ( ) to rid ourselves of any unnecessary terms and using eval( ) to plug in h=0 again. (Try to think about why we can’t just simplify the sec_slope(0) expression.) Notice that sec_slope is a function of h, whereas tan_slope is a function of x! eval(simplify(sec_slope(h)),h=0); 3 2 x 12 8 x 19 x (2.4) This worked only because Maple was able to cancel out the h in the denominator of sec_slope(h). If it couldn’t do that, we would instead have to apply Method 1 to get the general slope of a line tangent to the function f(x). The above output is an expression in Maple, which we need to turn into a function. (Think about the difference between an expression and a function.) To convert an output expression to a function of a particular variable, we can use the unapply ( ) command. Additionally, we can use % to reference the immediately preceding output, without going through the hassle of re−typing the command. Maple’s convenient like that. tan_slope:=unapply(%,x); ## converts most recent output to a function of ’x’ Now we have a function of x! (Note the arrow in the output.) 3 2 tan_slope := x x 12 8 x 19 x (2.5) Step 3: Plot the original f(x) and tan_slope(x) on the same graph, and compare them. The thickness plot option changes how thick the lines you plot appear. plot([f(x),tan_slope(x)],x=0..5,legend=["f(x)","f’(x)"],color= ["LimeGreen","Black"],thickness=2,linestyle=[1,4]); 10 5 0 1 2 3 4 5 x 5 10 f(x) f’(x) Now that we’ve put f(x) and f’(x) on the same graph, it’s time to see what it all means. Notice that tan_slope (x) a.k.a f’(x) hits zero at three spots. Since f’(x) is ’well behaved’ everywhere, these points correspond to all of the critical points of f. Let’s ask Maple to solve for them, and save the answers to a list called ’zeros.’ crit_pts:=solve(tan_slope(x)=0,x); crit_pts := 1, 3, 4 (2.6) With this information, we can create some vertical lines to plot along with the two functions above to see what the ’zeros’ we define above actually mean. To do this, we’ll make use of the plots[display]( ) command, which will allow us to plot different types of information (vertical lines included) all on one graph. First, define 3 vertical lines corresponding to the numbers in our ’zeros’ list. Since we only need 2 points to specify a line, we’ll use the lowest (−12) and highest (10) y−values on the above graph as our range for each line. vert_lines:=[seq([[crit_pts[i],−12],[crit_pts[i],10]],i=1..3)]; vert_lines := 1, 12 , 1, 10 , 3, 12 , 3, 10 , 4, 12 , 4, 10 (2.7) Next, save the vertical lines plot by assigning it the name ’p1.’ We’ll use the x− and y−axis limits that appear in the previous plot. p1:=plot(vert_lines,x=0..5,−12..10,color="Black",linestyle=2); p1 := PLOT ... (2.8) Now, reproduce the f(x)−tan_slope(x) plot, this time assigning the name ’p2.’ p2:=plot([f(x),tan_slope(x)],x=0..5,legend=["f(x)","f’(x)"],color= ["LimeGreen","Black"],thickness=[2,2],linestyle=[1,4]); p2 := PLOT ... (2.9) Lastly, stick everything on the same graph with the aforementioned plots[display]( ) command. As always, since we’re plotting more than one thing, we’ll need to use brackets to tell Maple that. plots[display]([p1,p2]); 10 5 0 1 2 3 4 5 x 5 10 f(x) f’(x) The plot domain is now separated into regions that describe the increasing/decreasing behavior of f(x). Lab 06 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: Read through the assignment to get a clear idea of what’s being asked of you. Be sure to follow the directions within each question. Useful Tip #2: Use your work from previous labs to remind yourself of commands that you may have forgotten. Useful Tip #3: Save your work early and often. Useful Tip #4: When in doubt, restart. Useful Tip #5: Make the size of your output graphs smaller to save paper when you print them. (Try this even if you ’print to file.’ You can see how much paper you’d use beforehand by going to File Print Preview.) (1) Describe the difference between an expression and a function in the world according to Maple. (2) Define the function G(x) = 0.01*x^5 − 0.25*x^4 + 2.30*x^3 − 9.50*x^2 + 16.89*x − 9.45. ## define your function Assume G(x) is the derivative of some unknown function g(x). Note: The rest of the assignment is based on this assumption. (3) Plot G(x) for x values between 0 and 10 and y−axis values between −2 and 2. ## plot command (4) Solve for the x−values for which G(x)=0, and assign a name to the result. ## find your critical points The next few exercises will walk you through creating a plot of vertical lines corresponding to each of the x−values you found in the previous exercise. (5)(a) How many critical points did Maple find? Assign this number to the letter ’n.’ ## critical point number (b) Define a list of vertical lines for each x−value, with a minimum y−value of −2 and a maximum value of 4. Replace any XXs appropriately. vert_lines:=[seq([[XX[i],XX],[XX[i],XX]],i=1..n)]; (c) Save a plot of your vertical lines to ’p1’ for x−values from 0 to 10 and for y−axis values between −2 and 4. Required: [1] Specify one linestyle to use for all vertical lines. [2] Specify a thickness of 1 to use for all lines. ## save p1 here (d) Now, save a plot of G(x) to ’p2’ for x−values from 0 to 10 and for y−axis values between −2 and 4. Required: [1] Specify a different linestyle from the one you used for your vertical lines. [2] Specify a thickness of 2 for G(x). ## save p2 here (e) Use plots[display]( ) to display your two saved plots on the same set of axes. ## display plots (6) Print out your graph, and with some writing utensil, start at the point (0,4) and draw a possible function g(x) whose derivative could be G(x), based solely on the increasing/decreasing information. Use the in−class example to help with the pattern. (7) Take a few minutes and lines to remind yourself of any old commands as well as any new ones we used today. Required: list and describe them. (8) Name at least one thing you wish you knew how to do in Maple.