Initial-Value Problems for Ordinary Differential Equations
Tsung-Min Hwang
Department of Mathematics National Taiwan Normal University, Taiwan
August 27, 2005
Outline
1 Euler’s Method Algorithm Error analysis
2 Higher-order Taylor methods Taylor methods
Outline
1 Euler’s Method Algorithm Error analysis
2 Higher-order Taylor methods Taylor methods
Algorithm
Obtain an approximation to the initial-value problem dy
dt =f (t, y ), a ≤ t ≤ b, y (a) = α.
Subdivide [a, b] into n subintervals of equal length h = (b − a)/n with mesh points {t0,t1, . . . ,tn} where
ti =a + ih, ∀ i = 0, 1, 2, . . . , n.
Recall the Taylor’s Theorem
y (ti+1) = y (ti) + (ti+1− ti)y0(ti) +(ti+1− ti)2 2 y00(ξi)
= y (ti) +hy0(ti) +h2
2y00(ξi) (1)
= y (ti) +hf (ti,y (ti)) + h2 2 y00(ξi) for some ξi ∈ (ti,ti+1).
Algorithm
We have the formulation of Euler’s method tk +1 = tk+h,
yk +1 = yk +hf (tk,yk), y0= α.
Example
Use Euler’s method to integrate dy
dx =x − 2y , y (0) = 1.
The exact solution is y = 1
4 h
2x − 1 + 5e−2xi .
Algorithm
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
y
Example 1 for Euler method
Exact h = 0.2 h = 0.1 h = 0.05
Error analysis
Lemma
0 ≤ (1 + x )m ≤ emx, ∀x ≥ −1, m > 0.
Proof: Applying Taylor’s Theorem, ex =1 + x + 1
2x2eξ, where ξ is between x and zero. Thus
0 ≤ 1 + x ≤ 1 + x + 1
2x2eξ=ex
⇒ 0 ≤ (1 + x)m≤ emx
Error analysis
Lemma
If s, t ∈ R+, {ai}ki=0is a sequence satisfying a0≥ −t/s, and ai+1 ≤ (1 + s)ai+t, ∀ i = 0, 1, . . . , k ,
then
ai+1≤ e(i+1)s
a0+ t
s
− t s.
Error analysis
Proof:
ai+1 ≤ (1 + s)ai+t
≤ (1 + s) [(1 + s)ai−1+t] + t
≤ (1 + s) {(1 + s) [(1 + s)ai−2+t] + t} + t ...
≤ (1 + s)i+1a0+h
1 + (1 + s) + (1 + s)2+ · · · (1 + s)ii t
= (1 + s)i+1a0+1 − (1 + s)i+1 1 − (1 + s) t
= (1 + s)i+1
a0+ t
s
− t s
≤ e(i+1)s
a0+ t
s
− t s
Error analysis
Theorem
Suppose f ∈ C(D) and satisfies a Lipschitz condition with constant L on
D = {(t, y )|a ≤ t ≤ b, −∞ < y < ∞}
and ∃ M with
|y00(t)| ≤ M, ∀ t ∈ [a, b].
Let y (t) denote the unique solution to (IVP) y0 =f (t, y ), a ≤ t ≤ b, y (a) = α,
and y0,y1, . . . ,ynbe the approximations generated by Euler’s method. Then
|y (ti) −yi| ≤ hM 2L
h
eL(ti−a)− 1i
, ∀i = 0, 1, . . . , n.
Error analysis
Proof: Since y (t0) =y0= α, it is true for i = 0.
For i = 0, 1, . . . , n − 1,
y (ti+1) =y (ti) +hf (ti,y (ti)) + h2 2y00(ξi) and
yi+1=yi+hf (ti,yi).
Consequently,
y (ti+1) −yi+1=y (ti) −yi+h [f (ti,y (ti)) −f (ti,yi)] + h2 2y00(ξi) and
|y (ti+1) −yi+1| ≤ |y (ti) −yi| + h|f (ti,y (ti)) −f (ti,yi)| + h2
2 |y00(ξi)|
≤ (1 + hL)|y (ti) −yi| +h2M 2
Error analysis
Referring to previous lemma and letting s = hL, t = h2M/2 and aj = |y (tj) −yj| ∀ j = 0, 1, . . . , n, we see that
|y (ti+1) −yi+1| ≤ e(i+1)hL
|y (t0) −y0| +h2M 2hL
−h2M 2hL.
= hM
2L
e(i+1)hL− 1
= hM 2L
e(ti+1−a)L− 1 since (i + 1)h = ti+1− t0=ti+1− a.
Taylor methods
Definition (Local truncation error) The difference method
y0 = α,
yi+1 = yi+hφ(ti,yi), ∀i = 0, 1, . . . , n − 1, has local truncation error
τi+1(h) = y (ti+1) − [y (ti) +hφ(ti,y (ti))]
h
= y (ti+1) −y (ti)
h − φ(ti,y (ti)),
∀ i = 0, 1, . . . , n − 1.
Taylor methods
For example, the local truncation error in Euler’s method at ith step is
τi+1(h) = y (ti+1) −y (ti)
h − f (ti,y (ti))
= y(ti) +hy0(ti) +h2y00(ξi) − y(ti)
h − f (ti,y (ti))
= h
2y00(ξi) for some ξi ∈ (ti,ti+1).
If |y00(t)| ≤ M ∀ t ∈ [a, b], then
|τi+1(h)| ≤ h 2M,
so the local truncation error in Euler’s method is O(h).
Taylor methods
To improve the convergence of difference methods, one way is selected difference-equations in such that their local truncation errors are O(hp)for as large a value of p as possible.
Suppose the solution y to (IVP) has (n + 1) continuous derivatives. Consider the nth Taylor polynomial of y (t) at ti,
y (ti+1) = y (ti) +hy0(ti) +h2
2 y00(ti) + · · · + hn
n!y(n)(ti) + hn+1
(n + 1)!y(n+1)(ξi) for some ξi ∈ (ti,ti+1). Since
y0(t) = f (t, y ), y00(t) = f0(t, y ),
...
y(k )(t) = f(k −1)(t, y ),
Taylor methods
we get
y (ti+1) = y (ti) +hf (ti,y (ti)) + h2
2 f0(ti,y (ti)) + · · · (2) +hn
n!f(n−1)(ti,y (ti)) + hn+1
(n + 1)!f(n)(ξi,y (ξi)). (3) Taylor method of order n
y0 = α,
yi+1 = yi+hT(n)(ti,yi), ∀i = 0, 1, . . . , n − 1, where
T(n)(ti,yi) =f (ti,yi) +h
2f0(ti,yi) + · · · +hn−1
n! f(n−1)(ti,yi).
Taylor methods
Example
y0 =y − t2+1, 0 ≤ t ≤ 2, y (0) = 0.5.
Consider Taylor’s method of order two and four.
f (t, y ) = y − t2+1, f0(t, y ) = d
dt
y − t2+1
=y0− 2t = y − t2+1 − 2t, f00(t, y ) = d
dt
y − t2+1 − 2t
=y0− 2t − 2
= y − t2+1 − 2t − 2 = y − t2− 2t − 1, f000(t, y ) = d
dt
y − t2− 2t − 1
=y0− 2t − 2
= y − t2+1 − 2t − 2 = y − t2− 2t − 1.
Taylor methods
So
T(2)(ti,yi) = f (ti,yi) +h
2f0(ti,yi)
= yi− ti2+1 + h 2
yi− ti2− 2ti+1
=
1 + h
2
yi− ti2+1
− hti
and
T(4)(ti,yi) = f (ti,yi) +h
2f0(ti,yi) +h2
6 f00(ti,yi) + h3
24f000(ti,yi)
= yi − t12+1 + h 2
yi− ti2− 2ti+1
+h2 6
yi− ti2− 2ti− 1 + h3
24
yi− ti2− 2ti− 1
Taylor methods
That is T(4)(ti,yi) =
1 + h
2 +h2 6 + h3
24
(yi− ti2) −
1 + h
3 + h2 12
hti +1 + h
2 −h2 6 − h3
24.
The Taylor methods of orders two and four are, consequently, y0 = 0.5,
yi+1 = yi+h
1 +h 2
yi− ti2+1
− hti
and
y0 = 0.5, yi+1 = yi +h
1 + h 2+ h2
6 + h3 24
(yi− ti2) −
1 + h
3 + h2 12
hti +1 + h
2− h2 6 − h3
24
.
Taylor methods
If h = 0.2, then n = 10 and ti =0.2i ∀ i = 1, 2, . . . , 10.
• The second-order method:
y0 = 0.5, yi+1 = yi+0.2
1 + 0.2 2
yi− 0.04i2+1
− 0.04i
= 1.22yi− 0.0088i2− 0.008i + 0.22.
• The fourth-order method:
yi+1 = yi +0.2
1 + 0.2
2 +0.04
6 +0.008 24
yi− 0.04i2
−
1 +0.2
3 +0.04 12
(0.04i) + 1 +0.2
2 −0.04
6 −0.008 24
= 1.2214yi − 0.008856i2− 0.00856i + 0.2186.
Taylor methods
• Exact solution y (t) = (t + 1)2− 0.5et.
• The fourth-order results are vastly superior.
Taylor methods
Theorem
If y ∈ Cn+1[a, b], then the local truncation error of Taylor’s method of order n is O(hn).
Proof: From Eq. (3), we have y (ti+1) − y (ti) −h
f (ti,y (ti)) +h
2f0(ti,y (ti)) + · · · + hn−1
n! f(n−1)(ti,y (ti))
= hn+1
(n + 1)!f(n)(ξi,y (ξi)) for some ξi in (ti,ti+1). So the local truncation error is
τi+1(h) = y (ti+1) −y (ti)
h − T(n)(ti,y (ti)) = hn
(n + 1)!f(n)(ξi,y (ξi)).
Since y ∈ Cn+1[a, b], we have y(n+1)(t) = f(n)(t, y (t)) bounded on [a, b] and τi =O(hn), ∀i = 1, 2, . . . , N.