Math 121 Calculus for Biology
Spring Semester, 2013
Lab Help

30-Jan-13

San Diego State University


Laboratory Help Page for Lab 2

This is your second computer lab. Most likely, you are paired with a different lab partner for this lab. The first question introduces you to the powerful symbolic programming language Maple. Maple provides a valuable tool for doing a number of mathematical operations symbolically. The second question advances the ideas of linear modeling using least squares analysis with a problem associated with measuring the concentration of urea in urine. The last question gives you practice with the material from lecture on weak acids. Your lecture notes should provide an excellent outline of what you want to do. You will be using many of the skills from the first lab to produce a good lab report and adding the ability to use the feature Trendline in Excel along with Maple.

Problem 1: This exercise is meant to introduce you to Maple. Part a. can be worked completely by hand, but I want you to try Maple to learn how to enter functions and solve for various points. As an example, let us consider the following two equations:

f(x) = x + 2 and g(x) = x2 - 2x - 2

We want to find the roots of the quadratic and the points of intersection of the two functions.

To enter the functions in Maple, we type

> f := x -> x + 2; g := x -> x^2 - 2*x - 2;

The f:= x -> is used to define the function f in Maple. The ; is crucial for ending all Maple commands (for classic Maple, but not the newer version). You can evaluate the function at x = 5 by simply typing

> f(5);

To find the solutions of the quadratic equation, there are two commands. The solve command solves the equations algebraically (exactly), while the fsolve command solves the equations numerically. Try the following commands in Maple to see what you get:

> solve(g(x)=0,x);

> fsolve(g(x)=0,x);

It is usually a good idea to have a graph of the functions with which you are working. The purpose of the graph is often just to visualize the functions in the problem. Graphing in Maple is very simple (though the output is not as elegant as it is in Excel). To graph the two functions f(x) and g(x), you simply type

> plot({f(x),g(x)},x = -5..5);

To find the points of intersection we need to set f(x) = g(x) and solve for x. Again we can do this using either solve or fsolve. (I would recommend against using solve if you have any polynomial of degree higher than 2.)

> solve(f(x)=g(x),x); fsolve(f(x)=g(x),x);

Notice that you can put multiple Maple commands on one line, and Maple does the operations in the order you place them.

If we want both the x and y values of the points of intersection, then we need the following (assuming 2 points of intersection, it varies slightly if there is only one point):

> xs := fsolve(f(x)=g(x),x); f(xs[1]); f(xs[2]);

The xs stores the values of x created by the fsolve command. Since we are assuming there are two values xs[1] gives the first x created by fsolve and xs[2] gives the second one. Writing f(xs[1]); gives the y value as it is the function evaluated at that x value. Note that if there was only one value, then it is xs and you get the y value by typing f(xs);

Problem 2: This problem is similar to the material in the lecture notes in the Function Review and Quadratics section on the synthesis of mRNA.You will probably want to reread those notes to help you understand this problem.The first part of this problem is similar to the problems you did last time using Excel's Trendline (Linear), except you must Set Intercept = 0 .

In Part c, you find the error terms much as you did in your homework. Each error term is the difference between the growth data point and r times the population data point or

ei = g(Pi) - rPi.

The sum of square errors is simply

J(r) = e12 + e22 + e32 + e42.

You can use Maple to easily simplify this expression. In Maple, use the command

> expand(J(r));

assuming you have properly defined J(r). Use the general formula of the parabola to find the r-coordinate of the vertex for Part c.

Problem 3: This problem is very much like the lecture notes on weak acids. The graphing part of this problem is easily done using the graphing template as you have done before. The graph cannot start at x = 0 because the logarithm is undefined at zero. Thus, do your graph for the given interval. To answer part c, you will need to compose the two functions. This means find: pH([H+](x)) and then solve pH([H+](x)) = 1. Hint: to solve your equation you may use the fact that x = log10(y) implies 10x = y and log(1/a) = -log(a). This is review material but you can look up in page 85 of the text book for the exponents and logarithmic rules.

The equilibrium constant for some weak acids is very small, so here we comment on the scientific display of numbers from computers. When numbers are very large or very small, computers often use an exponential form to display numbers. Thus, if we wanted to write 1.75x10-4, then the computer is likely to display this number as 1.75E-04 or 1.75e-04. You do NOT want to enter numbers into WeBWorK like this, as WeBWorK interprets a notation 1.75E-04 as something quite different. (I know this is an inconsistency in the program that you have to live with.)