Professional Documents
Culture Documents
Math 18.336, Spring 2004, Plamen Koev Odes
Math 18.336, Spring 2004, Plamen Koev Odes
Math 18.336, Spring 2004, Plamen Koev Odes
ODEs
We study
y(t) = f (y(t)),
y(0) = y0 ,
h
y (tn + n h).
2
Let
en = error = yn y(tn ) = computed exact.
Then the error satises
en+1 = en + h[f (yn ) f (y(tn ))] hn .
After some manipulation we get
eLT 1 h
M,
2
L
en
eLT 1 h
M,
2
L
but we have to use norms instead (1, 2, norms are all OK).
Consider the error more carefully now. We will show that there exists a function e(t) such that
yn = y(tn ) + he(tn ) + O(h2 ).
Consider two calculationsone with mesh size h and another with mesh size h/2. Write
comph yn
comph/2 y2n
Subtract:
comph yn comph/2 y2n = (h h/2)e(nh) + O(h2 ).
So we can gure out what the error is. Alternatively we can eliminate the error
2 comph yn comph/2 y2n = (2 1)y(tn ) + O(h2 ).
A combination between the computed values is a more accurate estimate of the exact solution than either
calculation. We obtained a second order method, instead of Eulers rst order method. What did we lose?
We lost our ability to tell what the new error is. This is typical. If you know what the error is you can
improve the calculation, but then you dont know what the error is.
To obtain information about the error we insert yn = y(tn ) + he(tn ) in Eulers method, use Taylor series
and obtain (after some work):
1
y + e f (y)e = O(h).
2
Dene
1
e (t) = f (y(t)) e(t) y (t), e(0) = 0.
2
This is called the variational equation. Now after some additional work we obtain
comp yn = exact y(t) + he(t) + O(h2 ).
Sti ODEs
Consider
y = (y 1)
for large , e.g. = 100, or = 1000, or = 106 . The solution is
y(t) = et (y(0) 1) + 1.
All solutions start o at y(0) and seek y 1 and the change for small t is very rapid.
2
1
, h = 1000
and h =
To be specic, take = 1000 and use Eulers method with h = 100
1
10000 .
1
100
with u0 = 1 + . Then
u1
u2
u3
=
=
=
1 9
1 + 92
1 93 ,
and in general un = 1 + (9)n . This is terrible with wild growth no matter how tiny is.
2
with u0 = 1 + . Then from the equation
Try h = 1000
un+1 = un + 2
and we have
u1
u2
u3
1
1+
1 ,
=
=
=
and in general un = 1 + (1)n . Our numerical solution still does not tend to the correct solution, but at
least the wild oscillations are gone.
1
Try h = 10000
with u0 = 1 + . Then from the equation
un+1 =
9
1
un +
10
10
2
and we have
u1
u2
u3
10
2
9
= 1+
10
3
9
= 1+
10
=
1+
9 n
and the numerical solution will nally converge to the correct solution y 1.
and in general un = 1 + 10
It seems fair to use small step size when the solution is changing rapidly, but it seems unfair to take small
steps past t = 1/10. For example if y(0) = 2, then y(t) = e1000t + 1 and e1000/10 + 1 = e100 + 1 = 1 in
double precision oating point arithmetic.
The problem has nothing to do with Eulers method. All explicit methods suer from the same problem.
The choice of y = (y 1) was somewhat arbitrary, we could have had the solution approaching any
function by choosing to solve instead
y = (y (t)) + (t),
which has a solution
y(t) = (t) + et (y(0) (0)).
So lets look at the simplest case (t) 0
y = y.
There is an interesting way out of this trouble, namely to use implicit methods. Implicit Euler:
un+1 = un + hf (un+1 ).
The trouble, of course, is computing un+1 from here, but we will worry about this later. Attack y = y:
un+1
(1 + h)un+1
un+1
So h =
1
1
1
1
10 , 100 , 1000 , 10000
un
gives
un
1+
1+
un
1+
un
n
1
u0 0 rapidly
1
101
10 1000
n
n
1
1
u0 0 rapidly
u0 =
1
11
1000
100
n
n
1
1
u
=
u0 0 sort of
0
1
2
1000 1000
n
n
1
10
u0 0 pretty slowly.
u
=
0
1
11
1000
10000
1
1+
= un + h()un+1
= un
1
=
un .
1 + h
u0 =
Only the last case follows the accurate solution accurately. For h =
y(tn )
1
10000
un
= en ln(10/11) u0 = en ln(1+1/10) u0 e
3
1
10
1
( 10
)
2
1
( 10
)
3
!
+...
u0
n = h y (t + h) f (y + hy (t + h)) y (t + h) ,
2
so |n | h2
C and similarly to the explicit Euler we get
|en |
e2LT
1
hC.
2L