Numerical
Numerical
Here, e.g., the map xa'→ x(t, xa) is continuous from Rn into (C ([a, b]) ,· ∞ ). A well-posed
problem is a reasonable problem to approximate numerically.
Grid Functions
Choo se a mesh width h (with 0 < h ≤ b − a), and let
h h¸x`˛ N = b—h a (greatest integer ≤ (b − a)/h). Let ti = a +
¸x`˛
(i = 0, 1, . .ih. , N) be the grid points in t (note: t0 = a),
t and let xi denote the approximation to x(ti). Note
a t1 t2 · · · tN
t0 that ti and xi depend on h, but we will usually
suppress this dependence in our notation.
b
Examples.
Euler’s Method. tangent line
x
xi+1 .
xi+1 = xi + hf (ti, .
........
.............
.
xi) ..................
...
Taylor Methods.
Let p be an integer ≥ 1. To see how the Taylor Method of order p is constructed, consider
the Taylor expansion of a Cp+1 solution x(t) of x′ = f (t, x):
p
x(t + h) = x(t) + hx′(t) + · · · h
+ x(p) (t) + ` O(h
p+1
)
˛ ¸ x
p!
rem ain d er term
where the remainder term is O(hp+1) by Taylor’s Theorem with remainder. In the ap-
proximation, we will neglect the remainder term, and use the DE x′ = f (t, x) to replace
x′(t), x′′(t), . . . by expressions involving f and its derivatives:
For higher derivatives, inductively differentiate the expression for the previous derivative,
and replace any occurrence of dtdx by f (t, x(t)). These expansions lead us to define the Taylor
methods of order p:
h
ψ(h, t, x) = T (h, t, x) ≡ f+ 2 (D f + (D f )f )2 .t x
(t,x)
We will use the notation Tp(h, t, x) to denote the ψ(h, t, x) function for the Taylor method
of order p.
Remark. Taylor methods of order ≥2 are rarely used computationally. They require deriva-
tives of f to be programmed and evaluated. They are, however, of theoretical interest in
determining the order of a method.
definition, or to guarantee that the solution x(t) is sufficiently smooth. Recall that∈ if f
Cp (in t and x), then the solution x(t) of the IVP x′ = f (t, x), x(a) = xa is in Cp+1([a,
b]). For “higher-order” methods, this smoothness is essential in getting the error to be
higher order in h. We will assume from here on (usually tacitly) that f is sufficiently
smooth when needed.
Examples.
Modified Euler’s Method
xi+1 = xi + hf ti + h , xi + h f (ti, xi)
2 2
2 2
(so ψ(h, t, x) = f t + h , x + h f (t, x) ).
2 2 2
x′ t + h
= f t + h, x t + h
,
2 2
using the Euler approximation to x t + h ≈ x(t) + h f (t, x(t)) .
h2 2
x′ t + ≈ 1 (x′(t) + x′(t + h)).
1 ∫ t+h
(x(t + h) − x(t)) 1 x′ ≈ 1 x′(t) + 1 x′(t + h).
=
2 2
h h t
Modified Euler and Improved Euler are examples of 2nd order two-stage Runge-
Kutta methods. Notice that no derivatives of f need be evaluated, but f needs to be
evaluated twice in each step (from xi to xi+1).
Before stating the convergence theorem, we introduce the concept of accuracy.
that is, the local truncation error is the amount by which the true solution of the DE fails to
satisfy the numerical scheme. l(h, t) is defined for those (h, t) for which 0 < h ≤ b − a and
a ≤ t ≤b −h.
Define
l(h, t)
τ (h, t)
= h
and set τi(h) = τ (h, ti). Also,
set
τ (h) = max |τ (h, t)| for 0 < h ≤ b − a.
a≤t≤b− h
Note that
l(h, ti) = x(ti+1) − (x(ti) + hψ(h, ti, x(ti))),
explicitly showing the dependence of l on h, ti, and x(t).
Definition. A one-step method is called [formally] accurate of order p (for a positive integer
p) if for any solution x(t) of the DE x′ = f (t, x) which is Cp+1, we have l(h, t) = O(hp+1).
Proof. Suppose the method is consistent. Fix a solution x(t). For 0 < h ≤ h0, let
Z(h) = max |ψ(0, s, x(s)) − ψ(h, t, x(t))|.
a≤s,t≤b, |s− t|≤h
|ei(h)| ≤ e i
|e0(h)| + τ (h) ,
K
so
—
|ei(h)| ≤ eK(b−a) K(b−a)
|e0(h)| + e 1 τ (h).
K
Moreover, τ (h) → 0 as h → 0. Therefore, if e0(h) → 0 as h → 0, then
max
0≤i≤h |ei(h)| → 0 as h → 0,
b−a
that is, the approximations converge uniformly on the grid to the solution.
Proof. Hold h > 0 fixed, and ignore rounding error. Subtracting
xi+1 = xi + hψ(h, ti, xi)
from
x(ti+1) = x(ti) + hψ(h, ti, x(ti)) + hτi,
gives
1)!
Fact. A one-step method xi+1 = xi + hψ(h, ti, xi) is accurate of order p if and only if
ψ(h, t, x) = Tp(h, t, x) + O(hp),
where Tp is the “ψ” for the Taylor method of order p.
Proof. Since
x(t + h) − x(t) = hTp(h, t, x(t)) + O(hp+1),
we have for any given one-step method that
l(h, t) = x(t + h) − x(t) − hψ(h, t, x(t))
= hTp(h, t, x(t)) + O(hp+1) − hψ(h, t, x(t))
= h(Tp(h, t, x(t)) − ψ(h, t, x(t))) + O(hp+1).
So l(h, t) = O(hp+1) iff h(Tp − ψ) = O(hp+1) iff ψ = Tp + O(hp).
Remark. The controlled growth of the effect of the local truncation error (LTE) from
previous steps in the proof of the convergence theorem (a consequence of the Lipschitz
continuity of ψ in x) is called stability. The theorem states:
Stability + Consistency (minimal accuracy) ⇒ Convergence.
In fact, here, the converse is also true.
Introduction to the Numerical Solution of IVP for ODE 51
with
Σ
m
ψ(h, t, x) = ajkj(h, t, x),
j=1
k1(h, t, x) = f (t, x)
and for 2 ≤ j ≤
m,
Σ
j−1
kj(h, t, x) = f (t + αjh, x + h βjrkr(h, t, x))
r=1
Σ
j−1
(*) αj = βjr (2 ≤ j ≤ m).
r=1
Example. m = 2
xi+1 = xi + h(a1k1(h, ti, xi) + a2k2(h, ti, xi))
where
So
ψ(h, t, x) = (a1 + a2)f + h(a2αDtf + a2β(Dxf )f ) +
Recalling that O(h2).
h
T2 = f + (Dtf + (Dxf )f ),
2
52 Ordinary Differential Equations
ψ = T2 + O(h2),
We require α = β as in (*) (we now see why this condition needs to be imposed), whereupon
these conditions become:
a1 + a2 = 1, a2α = 12 .
Examples.
(1) Setting α = 2 gives a2 = 1, a1 = 0, which is the Modified Euler method.
1
Remark. Note that an m-stage explicit RK method requires m function evaluations (i.e.,
evaluations of f ) in each step (xi to xi+1).
1 1 ← Euler’s method
2 2
3 3
4 4
5 4
6 5
7 6
8 7
Explicit RK methods are always stable: ψ inherits its Lipschitz continuity from f .
Example.
Modified Euler. Let L be the Lipschitz constant for f , and suppose h ≤ h0 (for some
h0 ≤ b − a).
2 2
xi+1 = xi + hf ti + h , xi + h f (ti, xi)
2 2
ψ(t, h, x) = f t + h , x + h f (t, x)
Introduction to the Numerical Solution of IVP for ODE 53
So
2 2
h
≤ L|x − y| + 2 L|f (t, x) − f (t, y)|
h 2
|ψ(h, t, x) − ψ(h, t, y)| ≤ L x + f (t, x) − y + h f (t, y)
h
≤ L|x − y| + 2 L |x − y|
≤ K|x − y|
where K = L + h02L2 is thus the Lipschitz constant for ψ.
k1 = f (ti, xi)
2 2
k2 = f ti + h , xi + hk1
k3 = f ti + 2h , xi + 2hk2
k4 = f (ti + h, xi +
hk3).
The same argument as above shows this method is stable.
Remark. RK methods require multiple function evaluations per step (going from xi to
xi+1). One-step methods discard information from previous steps (e.g., xi−1 is not used to
get xi+1
— except in its influence on xi). We will next study a class of multi-step methods. But first,
we consider linear difference equations.
Theorem. The solution set of (lh) is a k-dimensional vector space (a subspace of the set
of all sequences {xi}i≥0).
54 Ordinary Differential Equations
for j = 1, 2, . . . k and then solving (lh) gives a basis of the solution space of (lh).
Define the characteristic polynomial of (lh) to be
Let us assume that α0 /= 0. (If α0 = 0, (LDE) isn’t really a k-step difference equation
since we can shift indices and treat it˜ as a k-step difference equation˜for a k < k, namely
˜ k=k
−ν, where ν is the smallest index with αν /= 0.) Let r1, . . . , rs be the distinct zeroes of p,
with multiplicities m1, . . . , ms. Note that each rj /= 0 since α0 /= 0, and m1 + · · · + ms =
k. Then a basis of solutions of (lh) is:
}
{ilrij}∞i=0 : 1 ≤ j ≤ s, 0 ≤ l ≤ mj − 1 .
Fi+2 − Fi+1 − Fi = 0, F0 = 0, F1 = 1.
√ !i √ !i
Fi = C+ 1 + 5 + C− 1− 5
.
2 2
1 1+ 5 1− 5
Fi = √ − .
5 2 2
Since |r−| < 1, we
have √ !i
1− 5
→ 0 as i → ∞.
2
√ i
1 1+ 5
Hence, the Fibonacci sequence behaves asymptotically like the sequence √ 2
.
5
Introduction to the Numerical Solution of IVP for ODE 55
0 1
x0 −α0 ... −αk−1
and x˜0 =
is given by the I.C. So (lh) is equivalent to the one-step vector difference
x1
.
xk−1
equation
x˜i+1 = Ax˜i ,i ≥ 0,
i
whose solution is x˜ i = A˜x . The characteristic polynomial of (lh) is the characteristic
0
polynomial of A. Because A is a companion matrix, each distinct eigenvalue has only
one Jordan block. If A = PJP −1 is the Jordan decomposition of A (J in Jordan form, P
invertible), then i −1
˜xi = PJ P x˜ 0 .
Let Jj be the mj × mj block corresponding to rj (for 1 ≤ j ≤ s), so Jj = rjI + Zj, where Zj
denotes the mj × mj shift matrix:
0 1
... ..
Z =
j
. 0 .
Then
J i = (rj I + Zj )i = i−l l
Σ i r Z.
i
j j j
l=0
l
i j i of the form
Since l is a polynomial in i of degree l and Zmj = 0, we see entries in
x˜
(constant) ilri
j
for 0 ≤ l ≤ mj − 1.
56 Ordinary Differential Equations
where˜bi = [0, . . . , 0, bi]T . This leads to a discrete version of Duhamel’s principle (exercise).
Remark. All solutions {xi}i≥0 of (lh) stay bounded (i.e. are elements of l∞)
⇔ the matrix A is power bounded (i.e., ∃ M so that Ai ≤ M for all i ≥ 0)
⇔ the Jordan blocks J1, . . . , Js are all power bounded
Here we want to approximate the solution x(t) of this IVP for a ≤ t ≤ b at the points
ti = a + ih (where h is the time step), 0 h ≤ i ≤ b−a . The term xi denotes the
approximation to x(ti). We have set fi+j = f (ti+j, xi+j). We normalize the coefficients so
that αk = 1. The above is called a k-step LMM (if at least one of the coefficients α0 and
β0 is non-zero). The above equation is similar to a difference equation in that one is
solving for xi+k from xi, xi+1, . . . , xi+k−1. We assume as usual that f is continuous in (t, x)
and uniformly Lipschitz in x. For simplicity of notation, we will assume that x(t) is real
and scalar; the analysis that follows applies to x(t) ∈ Rn or x(t) ∈ Cn (viewed as R2n for
differentiability) with minor adjustments.
Example. (Midpoint rule) (explicit)
∫ ti+2
x(ti+2) − x(ti) = t x′(s)ds ≈ 2hx′(ti+1) = 2hf (ti+1, x(ti+1)).
i
The approximation
∫ ti+1
h
x(ti+1) − x(ti) = x′(s)ds ≈ (x′(ti+1 ) + x′(ti ))
ti 2
58 Ordinary Differential Equations
Explicit vs Implicit.
If βk = 0, the LMM is called explicit : once we know xi, xi+1, . . . , xi+k−1, we compute
imme- diately
Σ
k−1
xi+k = (hβjfi+j − αjxi+j ) .
j=0
On the other hand, if βk /= 0, the LMM is called implicit : knowing xi, xi+1, . . . , xi+k−1, we
need to solve
Σ
k−1
xi+k = hβkf (ti+k, xi+k) − (αjxi+j − hβjfi+j)
j=0
for xi+k.
Remark. If h is sufficiently small, implicit LMM methods also have unique solutions given h
and x0, x1, . . . , xk−1. To see this, let L be the Lipschitz constant for f . Given xi, . . . , xi+k−1,
the value for xi+k is obtained by solving the equation
where
Σ
k−1
gi = (hβjfi+j − αjxi+j)
j=0
is a constant as far as xi+k is concerned. That is, we are looking for a fixed point of
So by the Contraction Mapping Fixed Point Theorem, Φ has a unique fixed point. Any initial
guess for xi+k leads to a sequence converging to the fixed point using functional iteration
(l+1)
x(l) = hβkf (ti+k, ) + gi
x
i+k i+k
which is initiated at some initial point x(0)i+k. In practice, one chooses either
(2) a fixed number of iterations, using an explicit method to get the initial guess x(0)
i+k.
This pairing is often called a Predictor-Corrector Method.
Introduction to the Numerical Solution of IVP for ODE 59
If x ∈ Cp+1, then
′ (jh)p (p) p+1
x(t + jh) = x(t) + jhx (t) + · · · x (t) + ) and
+ O(h
p!
′ ′ 2 ′′
jp−1hp (p) p+1
hx (t + jh) = hx (t) + jh x (t) + · · · + (t) + O(h )
x (p − 1)!
and so
l(h, t) = C0x(t) + C1hx′(t) + · · · + Cphpx(p)(t) + O(hp+1),
where
C0 = α0 + · · · + αk
C1 = (α1 + 2α2 + · · · + kαk) − (β0 + · · · + βk)
.
C = 1 + 2qα +q · · · + )− 1 (β + 2q−1β + · · · + kq−1β ).
(α kα k 1 2 k
q
q!
1 2 (q − 1)!
Definition. A LMM is called accurate of order p if l(h, t) = O(hp+1) for any solution of
x′ = f (t, x) which is Cp+1.
Remarks.
(i) For the LTE of a method to be o(h) for all f ’s, we must have C0 = C1 = 0. To see
this, for any f which is C1, all solutions x(t) are C 2 , so
(ii) Note that C0, C1, . . . depend only on α0, . . . , αk, β0, . . . , βk and not on f . So
here, “minimal accuracy” is first order.
51 Ordinary Differential Equations
0
Definition. A LMM is called consistent if C0 = C1 = 0 (i.e., at least first-order accurate).
Remark. If a LMM is consistent, then any solution x(t) for any f (continuous in (t, x),
Lipschitz in x) has l(h, t) = o(h). To see this, note that since x ∈ C1,
x(t + jh) = x(t) + jhx′(t) + o(h) and hx′(t + jh) = hx′(t) + o(h),
so
l(h, t) = C0x(t) + C1hx′(t) + o(h).
Exercise: Verify that the o(h) terms converge to 0 uniformly in t (after dividing by h) as
h → 0: use the uniform continuity of x′(t) on [a, b].
is called convergent if for each IVP x′ = f (t, x), x(a) = xa on [a, b] (f ∈ (C, Lip)) and
for any choice of x0(h), . . . , xk−1(h) for which
we have
lim max |x(ti(h)) − xi(h)| = 0 .
h→0 {i:a≤ti(h)≤b}
Remarks.
(i) This asks for uniform decrease of the error on the grid as h → 0.
(ii) By continuity of x(t), the condition on the initial values is equivalent to xi(h) → xa
for i = 0, 1, . . . , k − 1.
Fact. If a LMM is convergent, then the zeroes of the (first) characteristic polynomial of the
method p(r) = αkrk + · · · + α0 satisfy the Dahlquist root condition:
(1) Let r be any zero of p(r). Then the solution with initial conditions
xi = hri for 0 ≤ i ≤ k − 1
is
b−a
xi = hri for 0 ≤ i ≤ .
h
Suppose h = b−a for some m ∈ Z. If the LMM is convergent, then
m
xm(h) → x(b) = 0
as m → ∞. But
b−a
xm(h) = hr = m r m.
m
So
b−a
|xm (h) − x(b)| = |rm| → 0 as m→∞
m
iff |r| ≤ 1.
(2) Similarly if r is a multiple zero of p(r), taking xi(h) = hiri for 0 ≤ i ≤ k − 1 gives
b−a
x (h) = hiri, 0 ≤ i ≤ .
i
h
b−a
So if h = , then
m b−a
x (h) = mrm = (b — a)rm,
m
m
so xm(h) → 0 as h → 0 iff |r| < 1.
Remark. If x ∈ Cp+1 and the LMM is accurate of order p, then| LTE /h = O(hp). To get
|
pth-order convergence (i.e., LHS = O(hp)), we need
1. Lemma. Consider
Σ
k
(li)
αjxi+j = bi for i ≥ 0 (where αk = 1),
j=0
with the initial values x0, . . . , xk−1 given, and suppose that the characteristic polynomial
Σk
p(r) = j=0 αjrj satisfies the Dahlquist root condition. Then there is an M > 0 such that
for i ≥ 0, !
Σ
i
|xi+k| ≤ M
max{|x0|, . . . , |xk−1|} + |bν| .
ν=0
Remark.
i
Recall that the Dahlquist root condition implies that there is an M > 0 for which
A ∞ ≤ M for all i ≥ 0, where
0 1
.. ..
. .
A=
0 1
−α0 ··· −αk−1
is the companion matrix for p(r), and · ∞ is the operator norm induced by the vector
norm · ∞. The M in the Lemma can be taken to be the same as this M bounding Ai ∞.
Proof. Let x˜i = [xi, xi+1, . . . , xi+k−1]T and bi =˜ [0, . . . , 0, bi]T . Then x˜i+1 = Axi ˜+ bi, so
by induction ˜
Σi
˜ i+1
xi+1 = A x0 + ˜ i−ν
A bν.
˜ ν=0
Thus
|xi+k| ≤ x
˜i+1 ∞
i
x0 ∞ + Σ Ai−ν
i+1
≤ ∞ ˜b ν
˜ ν=0
∞ ∞
≤ M( i
x0 ∞ +
Σ |bν|).
˜ ν=0
Introduction to the Numerical Solution of IVP for ODE 63
Proof of the LMM Convergence Theorem. The fact that convergence implies zero-
stability and consistency has already been discussed. Suppose a LMM is zero-stable
and consistent. Let x(t) be the true solution of the IVP x′ = f (t, x), x(a) = xa on [a, b], let
L be the Lipschitz constant for f , and set
Σ
k
β= |βj|.
j=0
αjxi+j = h βjfi+j.
j=0 j=0
Subtraction gives
Σ
k
αjei+j = bi,
j=0
where
Σ
k
bi ≡ h βj (f (ti+j, x(ti+j)) − f (ti+j, xi+j)) + li.
j=0
Then
Σ
k
|bi| ≤ h |βj|L|ei+j| + |li|.
j=0
So, by the preceeding Lemma with xi+k replaced by ei+k, we obtain for i ∈ I
" Σ #
|ei+k| ≤ E |bν|
i
M +
ν=0
" #
Σ
i k Σ
≤ M E + hL |βj||eν+j| + |lν|
Σ i
ν=0
with initial values yj = |ej| for 0 ≤ j ≤ k − 1. Then clearly by induction |ei+k| ≤ yi+k for
i ∈ I. Now
yk ≤ hM1kE + (M2E + M3 λ/h) ≤ M4E + M3λ/h,
where M4 = (b − a)M1k + M2. Subtracting (∗) for i from (∗) for i + 1 gives
yi+k+1 − yi+k = hM1yi+k, and so yi+k+1 = (1 + hM1)yi+k.
Therefore, by induction we obtain for i ∈ I:
yi+k = (1 + hM1)iyk
(b−a)/h
≤ (1 + hM1) yk
≤ eM (b−a)yk
1
≤ K1E + K2λ/h,