[ Mathematics 256 home page ]

Fifth laboratory - Fall 2002

Due: Friday, November 15, 2002 at 11:30pm

This laboratory involves an applet which is a general purpose tool to help you solve differential equations numerically by any one of several methods.

The relevant parts of the textbook for this lab are sections 3.1 to 3.3.


For technical reasons, while working on this lab, you must not reload or leave this page within your web browser. If you do leave and want to come back again, you should quit your browser and restart it, either from the background menu or a terminal window. Also, save your answers frequently by using the submittor at the end of the page.

Using the Applet

  1. Click inside the text area under Equations.
  2. Type into it the differential equation you want to solve, for example

    y' = x y^2 - cos(y)
  3. Press the Enter key.

    Points to keep in mind:

  4. After you enter a differential equation, an input area for the dependent variable (here y ) will appear under Initial Values. You can enter into it the initial value y0 of that variable.
  5. The initial and final values of the independent variable are set in the Initial X and Final X boxes on the left side. Thus if your initial condition was at x0 = 1 and you wanted the solution at xf = 3 you would enter 1 for Initial X and 3 for Final X.
  6. Click the left mouse button on Euler, and a list of numerical methods drops down. Click on the one you want to use.
  7. At Number of steps enter the number N of steps of the method to perform. Thus the step size will be h = (xf - x0)/N .
  8. When everything is set up, click the Go button. This will find an approximation to the solution of the initial value problem, and show you the final values of the variables under Final Values.
  9. To see a table of intermediate values, click the Results button. During the solution process, values of the variables are recorded at Number of saved values values of the independent variable (in addition to the initial values). This number can never be more than Number of steps. If it divides Number of steps evenly, the values are recorded at equal intervals.
  10. It is possible to enter more than one equation, and they don't all have to be differential equations. For example, if you want to compare the values of y to some known function of x, say x2, you could add a new equation (by clicking the Insert equation button), and enter the equation

    z = y - x^2

    Then when you click Go and Results, the applet will compute and show the values of z together with those of x and y.

On some computers, the applet window may not be large enough to accommodate the applet. If you see "Try this at a larger size" in the bottom left of the applet window, try the wider version of this page.

What to do with the tool

Use DECal to solve the initial value problem

y' = 4 y - x
(0) = 1

You should be able to solve this equation explicitly. On the other hand, if you use one of the three methods - Euler, Improved Euler and Runge-Kutta - then the error E for step size h should be approximately E = C hp for some constants C and p (different for each method). The values of p are

In other words, if y*(h) is the approximate value for y at xf that you get with step size h then

The true value of y at xf is roughly y*(h) + C hp for small h .

The first questions

You may enter numbers in either fixed or scientific notation, as 1056 or 1.056e3 , 0.00001 or 1.0e-5 .

The second questions


There is no reason, in principle, that you will not be able to submit your answers from anywhere in the Internet, but we cannot guarantee success. If a submission from within the Mathematics Department system is not successful, tell the TA.


Send questions about problems with submitter to the lab TA

Send mathematical questions about the labs to the professor in charge of Math 256: fournier@math.ubc.ca