Joseph M. Mahaffy SDSU
Math 124: Calculus for the Life Sciences Spring 2017
 |  Course Index  |  Lectures  |  HW Assign  |  Computer Lab  |  WeBWorK  |  Syllabus  |  Miscellaneous  ||  Home
 

Computer Lab Help 6


This page is designed to provide helpful information about the laboratory questions. You will find more details in the Lab Manual that accompanies this course. Begin this lab and every lab by introducing yourself to your partner. Determine the times when you can meet together during the week before the lab is due at your next Lab session. You should start this lab and each lab by typing the name of each team member and your computer number on the Lab Cover Page (or a copy of it).

This week is a shortened lab, as you are taking your first Lab Exam. The first half of the lab has you work on new problems associated with differentiation, while the second half of the lab has you work on the Lab Exam.

The first WeBWorK problem asks questions about this help page and appropriate lecture material. This should help you work through the Lab more smoothly. The first problem of the lab begins by geometrically examining the relationship of the derivative to the slope of a tangent line, then uses the definition of the derivative to find the derivative of a couple of functions. The second part of this question has you use Maple to find the derivative. The second problem starts with a basic model for the length of a species of fish as a function of age, then uses this information to study the derivative of the length, which gives growth rates for the fish as it ages. The last problem is an application of the derivative to find the maxima and minima of polynomials. This application comes from research of Boyd Collier, formerly in the Biology Department at SDSU. It examines the oxygen consumption of a beautiful, but nasty insect.

Problem 1: The first part of this question has you find two points on the curve generated by your function f(x) with the difference in the x values getting closer together. This produces a sequence of secant lines by finding the slope of each secant line and using the point-slope form of a line. In the limiting case, where the x values are arbitrarily close together this sequence of secant lines approaches the tangent line and the slope of the tangent line at the point of interest, x, gives the derivative of f(x) at x.

Computing the slope of the tangent line can be a tedious computation with lots of algebra. Maple does algebra and differentiation extremely well, so the next part of this lab problem uses Maple's symbolic algebra ability to handle the tedious computations. In class, we are finding the slope of the tangent line at a point (x0, f(x0)) by looking at the secant line through the points (x0, f(x0)) and (x0 + h , f(x0 + h)), then letting h tend to zero.

Below is an example that we will go through in lab to help you see the Maple commands for Parts b and c of Problem 1. As an example, let us consider the function

Rational Equation

Suppose we want to find the slope of the secant line through the points (-2, f(-2)) = (-2, 1) and (-2 +h, f(-2 +h)) = (-2+h, 1/(1+h)3). (Note that you will be using a value different from x0= -2, so make the appropriate changes below.) Below is the sequence of Maple commands to find the slope of both the secant and tangent lines.

First, you enter the function in the standard way for Maple:

> f : = x -> 1/(x+3)^3;

The slope of the secant line is found by the following:

> (f(-2+h) - f(-2))/h;
simplify(%);

The simplify command lets Maple find the easiest form of the expression that it chooses. (This may or may not be the best form to analyze.) Next we want the slope of the tangent line, which is found by letting h tend to zero. This is the derivative of f(x) at x = -2.

> m := limit(%, h = 0);

The m := is simply used to define the slope for future use. Maple has the limit command to take limits, which is mathematically a very difficult process. The % in Maple means to take the previous expression and place in the position with the %. (This can be a dangerous command to use, as it works on whatever you just did, not necessarily from the line above. If you do anything else, then use the cursor to return to a line with the %, then you may get the wrong result.)

Next we define tangent line (the command tline(x); gives you the equation of the tangent line), then plot both the function and the tangent line. (You will need to adjust the x and y values in the plot command to get the desired graph for your problem.)

> tline := x -> m*(x - (-2)) + f(-2); tline(x);

> plot({f(x), tline(x)}, x = -3..1, y = -10..20);

This completes Maple needed for the first parts of the problem.

The last part of the problem shows you how easily you can get a derivative using Maple. This is the way that many mathematicians actually do research when they need to accurately differentiate complicated expressions. Biologists often learn about a process through experimentation and recognizing patterns. Maple provides a powerful tool for performing differentiation, so it can act as your experimental device. Let Maple do the differentiations for you, then see if you can recognize patterns that eventually will become rules of differentiation.

You enter your function, for example:

> f := x -> x^2*exp(-1/x);

To differentiate, you simply type

> diff(f(x),x);

This is all that you have to do. Now that you have learned this basic Maple, you can use it to help you with answers to your differentiations in Homeworks. 

Problem 2: This problem starts with the use ofExcel's Solver to find the nonlinear least squares best fit to the data on the length of a species of fish as it ages. The remainder of this problem has you computing growth rates either directly from the data or from the best fitting function. Again you will be performing a fair number of repetitive computations, so it is advised that you use Excel's pull down feature to accelerate your calculations. This problem should help you build your intuition on how length is related to its derivative, the growth rate.

To evaluate a derivative of the von Bertalanffy model at a particular age we use the following sequence of Maple commands:

> L := t -> 172.5*(1 - exp(-0.5243*t));

> dL := diff(L(t),t);

> subs(t = 7.5,dL); evalf(%);

Problem 3: This problem begins as many other problems we have worked this semester, where you take the data from Professor Boyd Collier's "kissing bugs," and plot it in Excel. You use Excel's Trendline with a polynomial of degree 3 to find the best fit to the data. (Make sure that you have at least 5 significant figures in the coefficients formed by Trendline.) You will record this formula in your lab report.

To find the maximum and minimum of the cubic polynomial, you want to find the derivative of this function and set it equal to zero. The derivative of a cubic (you will soon see) is a quadratic, which you can solve by hand. This might be good practice for you to prepare for future exams. The easier way to work the differentiation part of this problem is to let Maple do the work for you. Below are a series of commands to show you how to find the minimum and maximum of a cubic polynomial in Maple.

The series of commands are to enter the function, differentiate the function, find when the derivative is zero, then use these values back in the original function. Here are those commands, which I will describe more in lab. (Notice you can use # in Maple to make comments. Anything following the # is ignored by Maple.)

> f := x -> 0.3*x^3-9.1*x^2+3.7*x+42.2; # This enters the function.

> df := diff(f(x),x); # This differentiates the function and assigns it to df.

> xm := fsolve(df=0,x); #This finds the x values at the extrema and assigns them to xm.

> f(xm[1]);f(xm[2]); #This finds the y values at the previous x values found above.

> subs(x=3,df); #This evaluates the derivative at x = 3.

The rest of the problem is interpreting your results in terms of the biology of the problem. 

 

Copyright © 2015 Joseph M. Mahaffy.