MA 231: LAB 1

Another Numerical Method Lab


This lab is due Tuesday, September 23, in class. Late labs will not be graded. You may use any technology that you have available: a spreadsheet, Mathematica, Matlab, programmable calculator, etc. You will be graded on exactly what is asked for in the instructions below. You need not turn in any additional data, graphs, paragraphs, etc. You should submit only what is called for, and in the order the questions are asked. Remember that you will be graded on your use of English, including spelling, punctuation, logic, as well as the mathematics.

IMPORTANT: The work you submit should be your own and nobody else's. Any exceptions to this will be dealt with harshly.


Your goal in this lab is to develop a numerical algorithm for approximating solutions to differential equations that works a little better than Euler's method. After you develop the required formulas, you will then compare the results to those obtained by Euler's method for a given differential equation and for several different step sizes.

Here is a qualitative description of the new method. READ THIS CAREFULLY. Your job is to translate this description into mathematical formulas. Suppose you start with the initial value problem

dy/dt = F(t,y), y(0)=y0.

Your goal is to obtain an iterative scheme just as in Euler's method that produces a sequence of values (tn, yn) that approximates the solution to the given initial value problem.

As with Euler's method, the new method begins with t0 = 0 and y0, the given initial value for the solution. We start with a given step size, say Delta t, and then we obtain tn+1 in the usual way by simply adding Delta t to tn.

To obtain yn+1 we modify Euler's method as follows. Be careful: you must read this very carefully to succeed. We will draw a straight line through the point (tn,yn) which will be different from the line we used in Euler's method. Then, as before, yn+1 will be obtained as the y-coordinate of the point on this line directly over t = tn+1. So all we need to do is tell you the slope of this straight line, then you can figure out what yn+1 is. The slope will be the average of the slopes of two straight lines. The first of these two lines is that given by Euler's method through the point A given by (tn,yn). This slope is given by the slope field at that point. The second straight line is displayed in this picture:

That is, the second straight line has slope given by the slope field, not at (tn,yn), but rather at the point on the first line directly over tn+1 (the point marked B in the picture). For your lab assignment, please answer each of the following questions in order. The dotted line in this picture then represents the average of these two slopes, i.e., the slope that you want.

1. This question should be answered BEFORE turning to technology. First give the formula you use to obtain yn+1 for the numerical solution of the initial value problem

dy/dt = F(t,y), y(0) = y0

with step size Delta t.

WARNING: Make sure that your answer here conforms to the instructions above. Otherwise it will be impossible to go on, since you have the wrong formula.

2. Now use the formula you derived in question 1 to approximate the value of y(1) the initial value problem

dy/dt= y+A, y(0) = y0 =B,

where A is the last non-zero digit in your student ID and B is the second last nonzero digit. For example, if your student ID is U123456789, then A = 9 and B=8 If your ID is U800706000, then A=6 and B=7. Use step size Delta t=0.1. List the values y0 through y10, i.e., the approximate y-values for t=0 to t=1. You may use a spreadsheet, Mathematica, or write your own program to compute these values.

3. Now repeat the previous question, this time using Euler's method rather than the new method.

4. What is the actual value for y(1)? That is, find the real solution to the differential equation and then compute y(1)

5. Which numerical method yields the better approximation?

6. Now repeat questions 2 and 3, this time with Delta t = 0.01. This time you should calculate y0 through y100 using both Euler's method and your new method. Simply list the last term for each method on your report, not all 100 terms. Again, which yields a better approximation?

7. Now compare the errors made in both numerical solutions. In an essay, discuss the question: How does changing the step size in both methods affect the error? More precisely, if you change the step size by a certain factor, how does the step size change in each method? You will need to perform several more experiments similar to those in questions 2-6 above. Use the same differential equation but different step sizes.