Math 121 Calculus for Biology |
17-Feb-01 | |
---|---|---|
|
|
|
This lab will introduce you to Maple, a symbolic algebra package. The emphasis of this lab is to use Maple to find intercepts and points of intersection or function evaluation. The two application problems should remind you of the class notes. Your solution to the acid problem should look very much like the one provided in the notes, while the third problem is very much like the applet application in the notes for mRNA synthesis.
Along with your lab today, you should have two additional sheets, this sheet and a sheet summarizing some file management methods for the computer. The file management sheet will give you information about changing passwords, accessing programs, and saving files on the H drive. This sheet will give you specifics for this lab.
Question 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:
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. 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);
The rest of Question #1 is much like what you have done before as far as graphing in Excel.
Question 2: 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, you graph for the given interval. To find the normality of the solution with the particular pH in the last part of this question, you might want to use the Maple's fsolve routine that you learned in Part a. (In Maple, the logarithm base 10 is written log10(x) and not log(x) as it is in Excel.)
Question 3: 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 Trendline, except you must set the y-intercept equal to zero.
In the second part, you will almost certainly want to use Maple to simplify your calculations and easily find the sum of squares quadratic function. Below are the Maple commands that you need (though of course you need to change the numbers in the sum of squares expression):
> J := (4100-8500*r)^2 + (6700-12300*r)^2+(17600-35200*r);
> expand(J);
That is all you have to do! Maple does all the hard work of the algebra.
When you graph the sum of squares expression, the error will be very large, so you should use scientific notation on the J (vertical) axis. This is done by double clicking on the vertical axis to bring up the format window. Select the "number" folder and choose "scientific" notation.