SDSU

Math 121 Calculus for Biology
Spring Semester, 2010
Lab Help

01-Feb-10

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.

Questions 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);

Question 2: This problem is a study of absorbance versus the concentration of urea. Spectrophotometers are standard laboratory equipment and an example of a linear relationship. This lab introduces you to using the Trendline feature of Excel, and supplements the lecture notes for least squares fit to data. Below is a list of steps for solving this problem:

  1. The easiest way in WeBWorK to make an accurate copy of your table in Excel is to first create a hardcopy of your Lab.
  2. Highlight the numbers in the table of the hardcopy of the Lab and copy this into a new Excel file. From the Excel main menu select Data, then choose the item labeled Text to Columns ... This will pop up a box where you can select the choice of delimited by space. When you finish this, you should have nice columns of accurately copied data with which to work.
  3. Use Chart Wizard to create a graph of the data. Select XY-Scatter with the default option of points (the first box already highlighted).
  4. Follow the directions to making the graph, giving it a title, labeling the axes, and giving the x-axis gridlines. Since there is only one graph you should probably remove the labeling option.
  5. After finishing this initial phase, you click (single) on the data points. (You can right click to get options directly.) Once the data points appear highlighted, you return to the Chart on the Main Menu and select Add Trendline.
  6. Under Trendline, you stay with the default, Linear. Next you select the Options folder in this window and check the box to Display equation on chart.
  7. To get more accuracy to match the answers in WeBWorK, you will want more significant figures. The easiest way to do this is right click on the formula box. Select Format Data Label, then choose Number, and finally select Scientific, using at least 4 Decimal places. This must be done before you modify anything in the formula box or Excel will not allow the formula to change.
  8. Move this equation to a more visible part of the graph and make any other touch-ups to make the graph look good. For example, you should click on the equation and change the y to A (for absorbance) and x to U (for Urea concentration) .
  9. Finally, paste this graph in your Word document.

Many of the remaining questions are handled by hand calculations with the information that you have acquired from the Trendline you just created. However, in Part c. you will want to take advantage of the Excel spreadsheet capabilities to compute the sum of square errors. Take your data set (assuming urea concentration in Column A and Absorbance in Column B), then in Column C use the equation from Trendlineto create the predicted values with the urea values from Column A. In Column D, you find the square error between Columns B and C. At the bottom of Column D, you can let Excel sum all the square errors in Column D to obtain your result.

Question 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.)