Numerical Analysis II: Xiaojing Ye, Math & Stat, Georgia State University
Numerical Analysis II: Xiaojing Ye, Math & Stat, Georgia State University
Spring 2020
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 1
Section 1
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 2
IVP of ODE
Remark
I f is given and called the defining function of IVP.
I α is given and called the initial value.
I y (t) is called the solution of the IVP if
I y (a) = α;
I y 0 (t) = f (t, y (t)) for all t ∈ [a, b].
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 3
IVP of ODE
Example
The following is a basic IVP:
0 et
y (t) = 2(t + 1) −
2
2 et 2
2 et
f (t, y (t)) = y (t) − t + 1 = (t + 1) − − t + 1 = 2(t + 1) −
2 2
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 4
IVP of ODE (cont.)
More general or complex cases:
I IVP of ODE system:
dy1
= f1 (t, y1 , y2 , . . . , yn )
dt
dy
2 = f2 (t, y1 , y2 , . . . , yn )
dt for a ≤ t ≤ b
..
.
dyn
= fn (t, y1 , y2 , . . . , yn )
dt
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 6
Some basics about IVP
Remark
We also call f is Lipschitz with respect to y with constant L, or
simply f is L-Lipschitz with respect to y .
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 7
Some basics about IVP
Example
Function f (t, y ) = t|y | is Lipschitz with respect to y on the set
D := {(t, y )|t ∈ [1, 2], y ∈ [−3, 4]}.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 8
5.2 A set D ⊂ R2 is said to be convex if whenever (t1 , y1 ) and (t2 , y2 ) belong to D, then
Some
((1 − λ)tbasics
1 + λt2 , (1about
− λ)y1 +IVP
λy2 ) also belongs to D for every λ in [0, 1].
In geometric terms, Definition 5.2 states that a set is convex provided that whenever
two points belong to the set, the entire straight-line segment between the points also belongs
to the set. (See Figure
Definition 5.1.) The
(Convex sets we consider in this chapter are generally of the form
sets)
D = {(t, y) | a ≤ t ≤ b and − ∞ < y < ∞} for some constants a and b. It is easy to verify
(seeAExercise R these
2
set D 7)∈ that is convex
sets are if whenever (t1 , y1 ), (t2 , y2 ) ∈ D there is
convex.
(1 − λ)(t1 , y1 ) + λ(t2 , y2 ) ∈ D for all λ ∈ [0, 1].
e 5.1
(t 2, y 2)
(t 2, y 2) (t1, y1)
(t1, y1)
5.3 Suppose f (t, y) is defined on a convex set D ⊂ R2 . If a constant L > 0 exists with
Numerical Analysis II – Xiaojing Ye, ! Georgia State University
! Math & Stat, 9
Some basics about IVP
Theorem
∂f
If D ⊂ R2 is convex, and | ∂y (t, y )| ≤ L for all (t, y ) ∈ D, then f is
Lipschitz with respect to y with constant L.
Remark
This is a sufficient (but not necessary) condition for f to be
Lipschitz with respect to y .
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 10
Some basics about IVP
Proof.
For any (t, y1 ), (t, y2 ) ∈ D, define function g by
Note that g (0) = f (t, y1 ) and g (1) = f (t, y2 ). This completes the
proof.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 11
Some basics about IVP
Theorem
Suppose D = [a, b] × R, a function f is continuous on D and
Lipschitz with respect to y , then the initial value problem
y 0 = f (t, y ) for t ∈ [a, b] with initial value y (a) = α has a unique
solution y (t) for t ∈ [a, b].
Remark
This theorem says that there must be one and only one solution of
the IVP, provided that the defining f of the IVP is continuous and
Lipschitz with respect to y on D.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 12
Some basics about IVP
Example
Show that y 0 = 1 + t sin(ty ) for t ∈ [0, 2] with y (0) = 0 has a
unique solution.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 13
Some basics about IVP
Definition (Well-posedness)
An IVP y 0 = f (t, y ) for t ∈ [a, b] with y (a) = α is called
well-posed if
I It has a unique solution y (t);
I There exist 0 > 0 and k > 0, such that ∀ ∈ (0, 0 ) and
function δ(t), which is continuous and satisfies |δ(t)| < for
all t ∈ [a, b], the perturbed problem z 0 = f (t, z) + δ(t) with
initial value z(a) = α + δ0 (where |δ0 | ≤ ) satisfies
Remark
This theorem says that a small perturbation on defining function f
by δ(t) and initial value y (a) by δ0 will only cause small change to
original solution y (t).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 14
Some basics about IVP
Theorem
Let D = [a, b] × R. If f is continuous on D and Lipschitz with
respect to y , then the IVP is well-posed.
Remark
Again, a sufficient but not necessary condition for well-posedness
of IVP.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 15
Euler’s method
y(t 2)
y(t 1)
y(t 0) ! α
t0 ! a t1 t2 . . . tN ! b t
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 16
Euler’s method
0 1 00
y (ti+1 ) = y (ti ) + y (ti )(ti+1 − ti ) + y (ξi )(ti+1 − ti )2
2
for some ξi ∈ (ti , ti+1 ). Note that ti+1 − ti = h and
y 0 (ti ) = f (ti , y (ti )), we get
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 17
y(t 1) y(t 1)
y(t 0) ! α y(t 0) ! α
Euler’s method
t0 ! a t1 t2 . t.0. !t aN !tb1 t 2t . . . tN ! b t
α)
Slope y"(a) ! f (a, Slope y"(a) ! f (a, α) w2 w2
w1 w1 w1 w1
α α α α
t0 ! a t1 t2 .t .0 .! taN !t 1b t 2 t. . . t N ! b t t0 ! a t1 t2 . .t .0 !t Na! bt 1 t2 t . . . tN ! b
y′ = yYe,−Math
Numerical Analysis II – Xiaojing t 2 +&1,
Stat, ′0 ≤t≤
Georgia 2, y(0) =
2 University
y = y − t + 1,
State
0 ≤0.5.
t ≤ 2, y(0) = 0.5. 18
Euler’s method
Example
Use Euler’s method with h = 0.5 for IVP y 0 = y − t 2 + 1 for
t ∈ [0, 2] with initial value y (0) = 0.5.
t0 = 0 : w0 = y (0) = 0.5
t1 = 0.5 : w1 = w0 + hf (t0 , w0 ) = 0.5 + 0.5 × (0.5 − 02 + 1) = 1.25
t2 = 1.0 : w2 = w1 + hf (t1 , w1 ) = 1.25 + 0.5 × (1.25 − 0.52 + 1) = 2.25
t3 = 1.5 : w3 = w2 + hf (t2 , w2 ) = 2.25 + 0.5 × (2.25 − 12 + 1) = 3.375
t4 = 2.0 : w4 = w3 + hf (t3 , w3 ) = 3.375 + 0.5 × (3.375 − 1.52 + 1) = 4.4375
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 19
Error bound of Euler’s method
Theorem
Suppose f (t, y ) in an IVP is continuous on D = [a, b] × R and
Lipschitz with respect to y with constant L. If ∃M > 0 such that
|y 00 (t)| ≤ M (y (t) is the unique solution of the IVP), then for all
i = 0, 1, . . . , N there is
hM L(t −a)
y (ti ) − wi ≤ e i −1
2L
Remark
I Numerical error depends on h (also called O(h) error).
I Also depends on M, L of f .
I Error increases for larger ti .
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 20
Error bound of Euler’s method
we get
Mh2
|y (ti+1 ) − wi+1 | ≤ |y (ti ) − wi | + h|f (ti , yi ) − f (ti , wi )| +
2
Mh2
≤ |y (ti ) − wi | + hL|yi − wi | +
2
Mh2
= (1 + hL)|yi − wi | +
2
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 21
Error bound of Euler’s method
Proof (cont).
Denote di = |y (ti ) − wi |, then we have
Mh2 hM hM
di+1 ≤ (1 + hL)di + = (1 + hL) di + −
2 2L 2L
for all i = 0, 1, . . . , N − 1. So we obtain
hM hM
di+1 + ≤ (1 + hL) di +
2L 2L
hM
≤ (1 + hL)2 di−1 +
2L
≤ ···
hM
≤ (1 + hL)i+1 d0 +
2L
hM hM
and hence di ≤ (1 + hL)i · 2L − 2L (since d0 = 0).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 22
Error bound of Euler’s method
Proof (cont).
Note that 1 + x ≤ e x for all x > −1, and hence (1 + x)a ≤ e ax if
a > 0.
Based on this, we know (1 + hL)i ≤ e ihL = e L(ti −a) since
ih = ti − a. Therefore we get
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 23
Error bound of Euler’s method
Example
Estimate the error of Euler’s method with h = 0.2 for IVP
y 0 = y − t 2 + 1 for t ∈ [0, 2] with initial value y (0) = 0.5.
∂f
Solution: We first note that ∂y = 1, so f is Lipschitz with respect
to y with constant L = 1. The IVP has solution
2 et 00 et e2
y (t) = (t − 1) − 2 so |y (t)| = | 2 − 2| ≤ 2 − 2 =: M. By
theorem above, the error of Euler’s method is
hM L(t −a) 0.2(0.5e 2 − 2)
y (ti ) − wi ≤ e i −1 = e ti − 1
2L 2
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 24
Error bound of Euler’s method
Example
Estimate the error of Euler’s method with h = 0.2 for IVP
y 0 = y − t 2 + 1 for t ∈ [0, 2] with initial value y (0) = 0.5.
Solution: (cont) 5.2 Euler’s Metho
Note
Numerical Analysis II – Xiaojing that&the
Ye, Math Stat,error
Georgiagrows slightly
State University as the value of t increases.
25 This contr
Round-off error of Euler’s method
Suppose ∃δ > 0 such that |δi | ≤ δ for all i, then we can show
1 hM δ
y (ti ) − ui ≤ + e L(ti −a) − 1 + δe L(ti −a) .
L 2 h
hM δ hM δ
Note that 2 +hqdoes not approach 0 as h → 0. 2 + h reaches
minimum at h = 2δM (often much smaller than what we choose in
practice).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 26
Higher-order Taylor’s method
Definition (Local truncation error)
We call the difference method
(
w0 = α
wi+1 = wi + hφ(ti , wi ), i = 0, 1, . . . , N − 1
Example
Euler’s method has local truncation error
yi+1 − (yi + hf (ti , yi )) yi+1 − yi
τi+1 (h) = = − f (ti , yi )
h h
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 27
Higher-order Taylor’s method
h2 00
0 hn (n)
y (ti+1 ) = y (ti ) + hy (ti ) + y (ti ) + · · · + y (ti ) + R
2 n!
hn+1 (n+1) (ξ )
where R = (n+1)! y i for some ξi ∈ (ti , ti+1 ).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 28
Higher-order Taylor’s method
First note that we can always write y (n) using f (t, y (t)):
y 0 (t) = f
y 00 (t) = f 0 = ∂t f + (∂y f )f
y 000 (t) = f 00 = ∂t2 f + (∂t ∂y f + (∂y2 f )f )f + ∂y f (∂t f + (∂y f )f )
···
y (n) (t) = f (n−1) = · · ·
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 29
Higher-order Taylor’s method
Now substitute them back to high-order Taylor’s approximation
(ignore residual R)
h2 00
0 hn (n)
y (ti+1 ) = y (ti ) + hy (ti ) + y (ti ) + · · · + y (ti )
2 n!
h2 0 hn (n−1)
= y (ti ) + hf + f + · · · + f
2 n!
We can get the n-th order Taylor’s method:
(
w0 = α
wi+1 = wi + hT (n) (ti , wi ), i = 0, 1, . . . , N − 1
where
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 30
Higher-order Taylor’s method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 31
Higher-order Taylor’s method
Theorem
If y (t) ∈ C n+1 [a, b], then the n-th order Taylor method has local
truncation error O(hn ).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 32
Runge-Kutta (RK) method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 33
Runge-Kutta (RK) method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 34
Runge-Kutta (RK) method
(2) h 0 h
T (t, y ) = f (t, y ) + f (t, y ) = f (t, y ) + (∂t f + ∂y f · f )
2 2
to get O(h2 ) error. Suppose we use af (t + α, y + β) (with some
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 35
Runge-Kutta (RK) method
(2) h hf
T (t, y ) = f + ∂t f + ∂y f
2 2
af (t + α, y + β) = af + aα∂t f + aβ∂y f
then we have
h h
a = 1, α= , β = f (t, y )
2 2
h h
af (t + α, y + β) = f t + , y + f (t, y )
2 2
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 36
Runge-Kutta (RK) method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 37
Runge-Kutta (RK) method
Remark
If we have (ti , wi ), we only need to evaluate f twice (i.e., compute
k1 = f (ti , wi ) and k2 = f (ti + h2 , wi + h2 k1 )) to get wi+1 .
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 38
Runge-Kutta (RK) method
We can also consider higher-order RK method by fitting
(3) h 0 h 00
T (t, y ) = f (t, y ) + f (t, y ) + f (t, y )
2 6
with af (t, y ) + bf (t + α, y + β) (has 4 parameters a, b, α, β).
hf 00
Unfortunately we can’t make match to the term of T (3) , which 6
h2
contains 6 f · (∂y f )2 , by this way. But it leaves us open choices if
we’re OK with O(h2 ) error: let a = b = 1, α = h, β = hf (t, y ),
then we get the modified Euler’s method:
w0 = α
h
wi+1 = wi + f (ti , wi ) + f (ti+1 , wi + hf (ti , wi )) , i = 0, 1, . . . , N − 1.
2
Example
Use Midpoint method (RK2) and Modified Euler’s method with
h = 0.2 to solve IVP y 0 = y − t 2 + 1 for t ∈ [0, 2] and y (0) = 0.5.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 40
Midpoint method: w2 = 1.22(0.828) − 0.0088(0.2)2 − 0.008(0.2) + 0.218
Runge-Kutta (RK) method
= 1.21136;
Modified Euler method: w2 = 1.22(0.826) − 0.0088(0.2)2 − 0.008(0.2) + 0.216
Example = 1.20692,
Use Midpoint method (RK2) and Modified Euler’s method with
Table 5.6 lists all the results
0 of the calculations.
2 For this problem, the Midpoint method
h =is0.2 to solve
superior IVP y Euler
to the Modified − t + 1 for t ∈ [0, 2] and y (0) = 0.5.
= ymethod.
Solution: (cont)
Table 5.6 Midpoint Modified Euler
ti y(ti ) Method Error Method Error
0.0 0.5000000 0.5000000 0 0.5000000 0
0.2 0.8292986 0.8280000 0.0012986 0.8260000 0.0032986
0.4 1.2140877 1.2113600 0.0027277 1.2069200 0.0071677
0.6 1.6489406 1.6446592 0.0042814 1.6372424 0.0116982
0.8 2.1272295 2.1212842 0.0059453 2.1102357 0.0169938
1.0 2.6408591 2.6331668 0.0076923 2.6176876 0.0231715
1.2 3.1799415 3.1704634 0.0094781 3.1495789 0.0303627
1.4 3.7324000 3.7211654 0.0112346 3.6936862 0.0387138
1.6 4.2834838 4.2706218 0.0128620 4.2350972 0.0483866
1.8 4.8151763 4.8009586 0.0142177 4.7556185 0.0595577
2.0 5.3054720 5.2903695 0.0151025 5.2330546 0.0724173
h h 2
T (3) (t, y ) = f (t, y ) + f 0 (t, y ) + f 00 (t, y )
2 6
with af (t, y ) + bf (t + α1 , y + δ1 (f (t + α2 , y + δ2 f (t, y )) ) (has 6
parameters a, b, α1 , α2 , δ1 , δ2 ) to reach O(h3 ) error.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 42
4-th Order Runge-Kutta (RK4) method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 43
4-th Order Runge-Kutta (RK4) method
Example
Use RK4 (with h = 0.2) to solve IVP y 0 = y − t 2 + 1 for t ∈ [0, 2]
and y (0) = 0.5.
Solution: With h = 0.2, we have N = 10 and ti = 0.2i for
i = 0, 1, . . . , 10. First set w0 = 0.5, then the first iteration is
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 46
High-order Runge-Kutta method
Example
Use RK4 (with h = 0.1), Midpoint (with h = 0.05), and Euler’s
method (with h = 0.025) to solve IVP y 0 = y − t 2 + 1 for
t ∈ [0, 0.5] and y (0) = 0.5.
5.4 Runge-Kutta Methods
Solution:
Table 5.10 Modified Runge-Kutta
Euler Euler Order Four
ti Exact h = 0.025 h = 0.05 h = 0.1
0.0 0.5000000 0.5000000 0.5000000 0.5000000
0.1 0.6574145 0.6554982 0.6573085 0.6574144
0.2 0.8292986 0.8253385 0.8290778 0.8292983
0.3 1.0150706 1.0089334 1.0147254 1.0150701
0.4 1.2140877 1.2056345 1.2136079 1.2140869
0.5 1.4256394 1.4147264 1.4250141 1.4256384
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 48
Error control
We recall that the local truncation errors of these two methods are:
yi+1 − yi
τi+1 (h) = − φ(ti , yi , h) ≈ O(hn )
h
yi+1 − yi
τ̃i+1 (h) = − φ̃(ti , yi , h) ≈ O(hn+1 )
h
Given that wi ≈ w̃i ≈ yi and O(hn+1 ) O(hn ) for small h, we see
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 49
Error control
n n n n |w̃i+1 − wi+1 |
|τi+1 (qh)| ≈ K (qh) = q Kh ≈ q ≤
h
So we need q to satisfy
h 1/n
q≤
|w̃i+1 − wi+1 |
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 50
Runge-Kutta-Fehlberg method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 51
Multistep method
Definition
Let m > 1 be an integer, then an m-step multistep method is
given by the form of
for i = m − 1, m, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 52
Multistep method
Definition
The local truncation error of the m-step multistep method above
is defined by
yi+1 − (am−1 yi + · · · + a0 yi−m+1 )
τi+1 (h) =
h
− bm f (ti+1 , yi+1 ) + bm−1 f (ti , yi ) + · · · + b0 f (ti−m+1 , yi−m+1 )
where yi := y (ti ).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 53
Adams-Bashforth Explicit method
for i = 1, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 54
Adams-Bashforth Explicit method: local truncation error
(k)
We denote yi := y (k) (ti ) for short. If wj = yj for j ≤ i, then
h2 00 h3 000
yi+1 = yi + + hyi0y + y (ξi ), ξi ∈ (ti , ti+1 )
2 i 6
h
wi+1 = yi + hyi0 + (yi0 − yi−1
0
),
2
0 0 00 h2 000
yi−1 = yi − hyi + y (ηi ), ηi ∈ (ti−1 , ti )
2
Plugging the equations above into the formula of local truncation error:
for some µi ∈ (ti−1 , ti+1 ), where in the last equality we used the intermediate value
1 y 000 (ξ )+ 1 y 000 (η )
i i
theorem and y ∈ C3 (so y 000 is continuous) to obtain y 000 (µi ) = 6
1+1
4
6 4
which is between y 000 (ξi ) and y 000 (ηi ).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 55
Adams-Bashforth Explicit method
for i = 2, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 56
Adams-Bashforth Explicit method
for i = 3, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 57
Adams-Bashforth Explicit method
for i = 4, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 58
Adams-Moulton Implicit method
for i = 1, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 59
Adams-Moulton Implicit method
for i = 2, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 60
Adams-Moulton Implicit method
for i = 3, . . . , N − 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 61
Steps to develop multistep methods
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 62
Explicit vs. Implicit
h
wi+1 = ··· + f (ti+1 , wi+1 ) + · · ·
xxx
which can be difficult or even impossible.
I There could be multiple solutions of wi+1 when solving the
equation above in implicit methods.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 63
Predictor-Corrector method
In each step i:
I Prediction: Compute wi+1 using an explicit method φ to get
wi+1,p using
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 64
Predictor-Corrector method
Example
Use the Adams-Bashforth 4-step explicit method and
Adams-Moulton 3-step implicit method to form the Adams
4th-order Predictor-Corrector method.
With initial value w0 = α, suppose we first generate w1 , w2 , w3
using RK4 method. Then for i = 3, 4, . . . , N − 1:
I Use Adams-Bashforth 4-step explicit method to get a
predictor wi+1,p :
h h i
wi+1,p = wi + 55f (ti , wi ) − 59f (ti−1 , wi−1 ) + 37f (ti−2 , wi−2 ) − 9f (ti−3 , wi−3 )
24
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 65
respectively,method
Predictor-Corrector compared to those of Runge-Kutta, which were accurate, re
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 66
Other Predictor-Corrector method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 67
Predictor-Corrector method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 68
Variable step-size multistep method
Now let’s take a closer look at the errors of the multistep methods.
Denote yi := y (ti ).
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 69
Variable step-size multistep method
Consider the their local truncation errors:
251 (5)
yi+1 − wi+1,p = y (µi )h5
720
19 (5)
yi+1 − wi+1 =− y (µ̃i )h5
720
1 3 (5)
wi+1 − wi+1,p = (19 + 251)y (µi )h ≈ y (µi )h5
(5) 5
720 8
So the error of Adams-Moulton (corrector step) is
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 71
System of differential equations
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 72
N subintervals with the mesh points
Suppose that the values w1, j , w2, j , . . . , wm, j have been computed. We obtain w1, j+1 ,
w2, j+1 , . . . , wm, j+1 by first calculating
Definition
A function f is called Lipschitz with respect to u1 , . . . , um on
D := [a, b] × Rm if there exists L > 0 s.t.
m
X
|f (t, u1 , . . . , um ) − f (t, z1 , . . . , zm )| ≤ L |uj − zj |
j=1
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 74
System of differential equations
Theorem
∂f
If f ∈ C 1 (D) and | ∂u j
| ≤ L for all j, then f is Lipschitz with
respect to u = (u1 , . . . , um ) on D.
Proof.
Note that D is convex. For any (t, u1 , . . . , um ), (t, z1 , . . . , zm ) ∈ D,
define
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 75
System of differential equations
Theorem
If f ∈ C 1 (D) and is Lipschitz with respect to u = (u1 , . . . , um ),
then the IVP with f as defining function has a unique solution.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 76
System of differential equations
a = (α1 , . . . , αm )
y = (y1 , . . . , ym )
w = (w1 , . . . , wm )
f(t, w) = (f1 (t, w), . . . , fm (t, w))
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 77
System of differential equations
Example
Use RK4 (with h = 0.1) to solve IVP for ODE system
(
I10 (t) = f1 (t, I1 , I2 ) = −4I1 + 3I2 + 6
I20 (t) = f2 (t, I1 , I2 ) = −2.4I1 + 1.6I2 + 3.6
for all t ≥ 0.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 78
As a consequence,
System of differential equations
1
I1 (0.1) ≈ w1,1 = w1,0 + (k1,1 + 2k2,1 + 2k3,1 + k4,1 )
6
Example
1
= 0
Use RK4 (with h = 0.1) to + + 2(0.534)
solve
(0.6 IVP for+ODE
2(0.54072)
system + 0.4800912) = 0.5382552
6
(
and I10 (t) = f1 (t, I1 , I2 ) = −4I1 + 3I2 + 6
0 1I ) = −2.4I + 1.6I + 3.6
I2 (0.1) I≈2 (t)
w2,1=
= fw
2 (t,
2,0
I
+1 , 2 1,2 + 2k2,2 +1 2k3,2 + k24,2 ) = 0.3196263.
(k
6
withThe remaining
initial value entries
I1 (0) in
= Table
I2 (0)5.19
= 0.are generated in a similar manner. !
Solution: (cont) The result by RK4 is
Table 5.19 tj w1,j w2,j |I1 (tj ) − w1,j | |I2 (tj ) − w2,j |
0.0 0 0 0 0
0.1 0.5382550 0.3196263 0.8285 × 10− 5
0.5803 × 10− 5
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 79
High-order ordinary differential equations
Definition
A function y (t) is a solution of IVP for the mth-order ODE
above if y (t) satisfies the differential equation for t ∈ [a, b] and all
initial value conditions at t = a.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 80
High-order ordinary differential equations
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 81
High-order ordinary differential equations
Example
Use RK4 (with h = 0.1) to solve IVP for ODE system
y 00 − 2y 0 + 2y = e 2t sin t, t ∈ [0, 1]
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 82
High-order ordinary differential equations
Example
Use RK4 (with h = 0.1) to solve IVP for ODE system
y 00 − 2y 0 + 2y = e 2t sin t, t ∈ [0, 1]
In Maple the nth derivative y(n) (t) We can also use dsolve from Maple on higher-order equations. To define the differential
is specified by (D@@n)(y)(t). equation in Example 1, use
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 83
A brief summary
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 84
Stability of difference methods
Definition (Consistency)
A difference method is called consistent if
lim max τi (h) = 0
h→0 1≤i≤N
Remark
Since local truncation error τi (h) is defined assuming previous
wi = yi , it does not take error accumulation into account. So the
consistency definition above only considers how good φ(t, wi , h) in
the difference method is.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 85
Stability of difference methods
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 86
Stability of difference methods
Example
Show that Euler’s method is convergent.
Solution: We have showed before that for fixed h > 0 there is
hM L(t −a) hM
y (ti ) − wi ≤ e i −1 ≤ e L(b−a) − 1
2L 2L
for all i = 0, . . . , N. Therefore we have
hM L(b−a)
max y (ti ) − wi ≤ e −1 →0
1≤i≤N 2L
as h → 0. Therefore limh→0 (max1≤i≤N y (ti ) − wi ) = 0.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 87
Stability of difference method
Definition
A numerical method is called stable if its results depend on the
initial data continuously.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 88
Stability of difference methods
Theorem
For a given IVP y 0 = f (t, y ), t ∈ [a, b] with y (a) = α, consider a
difference method wi+1 = wi + hφ(ti , wi , h) with w0 = α. If there
exists h0 > 0 such that φ is continuous on [a, b] × R × [0, h0 ], and
φ is L-Lipschitz with respect to w , then
I The difference method is stable.
I The difference method is convergent if and only if it is
consistent (i.e., φ(t, y , 0) = f (t, y )).
I If there exists bound τ (h) such that |τi (h)| ≤ τ (h) for all
i = 1, . . . , N, then |y (ti ) − wi | ≤ τ (h)e L(ti −a) /L.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 89
Stability of difference methods
Proof.
Let h be fixed, then wi (α) generated by the difference method are
functions of α. For any two values α, α̂, there is
|wi+1 (α) − wi+1 (α̂)| = |(wi (α) − hφ(ti , wi (α), h)) − (wi (α̂) − hφ(ti , wi (α̂), h))|
≤ |wi (α) − wi (α̂)| + h|φ(ti , wi (α), h) − φ(ti , wi (α̂), h)|
≤ |wi (α) − wi (α̂)| + hL|wi (α) − wi (α̂)|
= (1 + hL)|wi (α) − wi (α̂)|
≤ ···
≤ (1 + hL)i+1 |w0 (α) − w0 (α̂)|
= (1 + hL)i+1 |α − α̂|
≤ (1 + hL)N |α − α̂|
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 90
Stability of difference method
Example
Use the result of Theorem above to show that the Modified Euler’s
method is stable.
Solution: Recall the Modified Euler’s method is given by
h
wi+1 = wi + f (ti , wi ) + f (ti+1 , wi + hf (ti , wi ))
2
So we have φ(t, w , h) = 12 (f (t, w ) + f (t + h, w + hf (t, w ))).
Now we want to show φ is continuous in (t, w , h), and Lipschitz
with respect to w .
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 91
Stability of difference method
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 92
Stability of multistep difference method
Definition
Suppose a multistep difference method given by
Definition
A difference method is said to satisfy the root condition if all the
m roots λ1 , . . . , λm of its characteristic polynomial have
magnitudes ≤ 1, and all of those which have magnitude =1 are
single roots.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 93
Stability of multistep difference method
Definition
I A difference method that satisfies root condition is called
strongly stable if the only root with magnitude 1 is λ = 1.
I A difference method that satisfies root condition is called
weakly stable if there are multiple roots with magnitude 1.
I A difference method that does not satisfy root condition is
called unstable.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 94
Stability of multistep difference method
Theorem
I A difference method is stable if and only if it satisfies the root
condition.
I If a difference method is consistent, then it is stable if and
only if it is convergent.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 95
Stability of multistep difference method
Example
Show that the Adams-Bashforth 4-step explicit method is strongly
stable.
Solution: Recall that the method is given by
h h i
wi+1 = wi + 55f (ti , wi ) − 59f (ti−1 , wi−1 ) + 37f (ti−2 , wi−2 ) − 9f (ti−3 , wi−3 )
24
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 96
Stability of multistep difference method
Example
Show that the Milne’s 4-step explicit method is weakly stable but
not strongly stable.
Solution: Recall that the method is given by
4h h i
wi+1 = wi−3 + 2f (ti , wi ) − f (ti−1 , wi−1 ) + 2f (ti−2 , wi−2 )
3
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 97
Stiff differential equations
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 98
Stiff differential equations
Example
Use RK4 to solve the IVP for a system of two ODEs:
0 1
u1 = 9u1 + 24u2 + 5 cos t − sin t
3
0 1
u2 = −24u1 − 51u2 − 9 cos t + sin t
3
Now let’s use a simple example to see why this happens: consider
an IVP y 0 = λy , t ≥ 0, and y (0) = α. Here λ < 0. We know the
problem has solution y (t) = αe λt .
In order for the error not to blow up, we need at least |1 + λh| < 1,
2
which yields h < |λ| . So h needs to be sufficiently small for large λ.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 101
Stiff differential equations
Similar issue occurs for other one-step methods, which for this IVP
can be written as wi+1 = Q(λh)wi = · · · = (Q(λh))i+1 α. For the
solution not to blow up, we need |Q(λh)| < 1.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 102
Stiff differential equations
h
:
F (w ) = w − wi − (f (ti+1 , w ) + f (ti , wi )) = 0
2
We can use fixed point iteration or Newton’s method to solve
F (x) = 0.
Numerical Analysis II – Xiaojing Ye, Math & Stat, Georgia State University 103