Fall 2003 Math 308/501–502
Numerical Methods
1.4 Euler’s Method
Fri, 24/Oct
c
±
2003, Art Belmonte
Summary
Geometrical idea
Euler’s method numerically approximates the solution of
y
0
=
f
(
t
,
y
),
y
(
a
)
=
y
0
by following tangent lines at discrete points. Think of tangent line
segments that form the background of a
dﬁeld7
plot. Figures in
Section 1.4 are illustrative in this regard.
The numerical algorithm
Let [
a
,
b
] be the interval over which an approximation to the
solution is desired. (Thus
t
=
a
and
t
=
b
are the initial and ﬁnal
values of the independent variable, respectively.) Partition this
interval into
N
subintervals each of length
h
=
(
b

a
)/
N
, called
the
step size
.Le
t
t
0
=
a
and deﬁne
t
k
+
1
=
t
k
+
h
,
for
k
=
0
,
1
,...,
N

1
.
Notice that
t
N
=
b
and the other
t
k
sodeﬁned are the interior
endpoints of the subintervals. These collectively are the discrete
values of the independent variable.
The initial value of the dependent variable is given by the initial
condition,
y
(
a
)
=
y
(
t
0
)
=
y
0
. The other discrete dependent
variable values are computed iteratively as follows.
for
k
=
0to
N

1
t
k
+
1
=
t
k
+
h
y
k
+
1
=
y
k
+
hf
(
t
k
,
y
k
)
Euler’s method is a
singlestep
numerical solver since it depends
only on data obtained from the preceding step. It is a
ﬁxedstep
solver since the lengths of the subintervals of [
a
,
b
] are all equal.
The error in the approximation
In general, as the step size decreases, so does the error in the
approximation. This error consists of two parts,
roundoff error
and
truncation error
. MATLAB does ﬂoating point
computations in double precision, so roundoff error is usually not
an issue. The truncation error results from the fact that we are
following the tangent line at a given point in the plane rather than
a solution curve itself. Moreover, there is a truncation error at
each step of the iteration as well as a propagated truncation error
due to errors from previous steps.
The truncation error at each step is proportional to
h
2
.However
,
due to propagated truncation error (which can grow exponentially
over time), the maximum total error of the approximation at
t
=
b
satisﬁes the following error bound.
maximum error
≤
M
L
±
e
L
(
b

a
)

1
²
h
Here
L
=
max
(
t
,
y
)
∈
R
³
³
³
³
∂
f
∂
y
³
³
³
³
and
M
=
1
2
max
(
t
,
y
)
∈
R
³
³
³
³
∂
f
∂
t
+
f
∂
f
∂
y
³
³
³
³
where
R
is a rectangle containing the solution curve. The fact that
h
occurs
to the ﬁrst power in the error bound is the reason that we say that
Euler’s method is a
ﬁrstorder
method.
Systems
Euler’s method carries over directly to systems of ﬁrstorder
equations. We simply write the algorithm in terms of vectors. Let
u
0
=
f
(
t
,
u
),
u
(
t
0
)
=
u
0
where
u
=
[
u
1
,
u
2
u
n
]
T
is an
n
dimensional
column
vector.
With the
t
k
deﬁned as above, we have
for
k
=
N

1
t
k
+
1
=
t
k
+
h
u
k
+
1
=
u
k
+
h
f
(
t
k
,
u
k
)
Hand Examples
We’ll do one problem by hand. Numerical methods are best done
with a computer, so make sure you study the MATLAB examples
below carefully!