$30
MATH 340
LAB 13 Assignment
ODEs:
Implicit Euler
We want to solve the initial value problem:
(
Y
0
(t) = f(x, Y (t)), t0 ≤ t ≤ tf
Y (t0) = Y0
(1)
To solve this numerically, we discretize the time interval [t0, tf ] with a grid of n+1
points t0 < t1 < . . . < tn with equal step size h (or in other words ti = t0 + ih, i =
0, 1, . . . , n). We seek the discrete approximated solution to this problem, say wi+1.
Euler’s backward (or implicit) method is defined by the iterative scheme:
wi+1 = wi + hf(ti+1, wi+1), 0 ≤ i ≤ n (2)
with initial condition given by w0 = Y0.
Problem 1:
Recast the following problem by hand to isolate the wi+1 term on the LHS to
implement your own Implicit Euler Method for
(
y
0
(t) = −5y, 0 ≤ t ≤ 2
y(0) = 1
(3)
whose actual solution is Y (t) = e
−5t
.
Implement your own Implicit Euler’s scheme to find the approximated solutions
at the point t = 2, for h = 20
, 2
−1
, . . . , 2
−4
. Write your results in a table with
columns in order: hi
, the approximated solution whi
(t = 2), the error ehi
(t = 2) =
|Y (t = 2) − whi
(t = 2)|, and the ratio Rhi
(t = 2) = ehi−1
(t=2)
ehi
(t=2) . What is the order
of convergence? How can you infer it from the table? Plot in the same figure the
approximations wh you have found for all five values of h together with the actual
1
solution Y (t) for t ∈ [0, 2]. Repeat the whole exercise with the code for Explicit
Euler’s scheme. How do the two method compare?
2