[ Mathematics 256 home page ]
Fifth laboratory - Fall 2002
Due: Friday, November 15, 2002 at 11:30 P.M..
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.
your answers frequently by using the submittor
at the end of the page.
Using the Applet
- Click inside the text area under Equations.
- Type into it the differential equation you want to solve,
y' = x y^2 - cos(y)
- Press the Enter key.
Points to keep in mind:
- The derivative is denoted by an apostrophe '.
- The independent variable is normally x ,
but you can change this by clicking on the choice box after Independent Variable.
- You can use either *
or space for multiplication. For example,
4 x y and 4*x*y are both OK.
But don't just write xy without a space.
- Use the caret ^ (on the 6 key) for exponents.
- Use exp(x) instead of e^x.
- Functions such as sin and exp need parentheses around
- There is no distinction between upper and lower case.
- 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
- 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
wanted the solution at xf = 3 you would enter 1 for Initial X and 3 for
- Click the left mouse button on Euler, and
a list of numerical methods drops down.
Click on the one you want to use.
- 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 .
- 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.
- 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.
- 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.
What to do with the tool
Use DECal to solve the initial value problem
y' = 4 y - x
y(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
- Euler: p = 1
- Improved Euler: p = 2
- Runge-Kutta: p = 4
The true value of y at xf
is roughly y*(h) + C hp for small h .
The first questions
Obtain values for y at
x=1 using step
sizes 0.025 and 0.0125
with each of the three methods.
Obtain the value of y at
x=1 by finding the exact solution.
- Find the errors for each method and stepsize by comparing with the
exact value and using the equation:
Exact value = approximate value + error
Find the constant C for
each method. Then use this to predict a step size h for which
the error should be about 10-6 .
You may enter numbers in either fixed or scientific notation,
as 1056 or 1.056e3 , 0.00001 or 1.0e-5 .
The second questions
Consider the initial value problem
y' = y2 - 3 x
y(0) = 1 . This is
not one that you can solve exactly. Obtain values for y
sizes 0.1 and
0.05 with each of the
three methods, and use Richardson extrapolation to predict a step size
h for which
the error in that method should be about 10-6 .
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: