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
dfield7
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 final
values of the independent variable, respectively.) Partition this
interval into
N
subintervals each of length
h
=
(
b

a
)/
N
, called
the
step size
. Let
t
0
=
a
and define
t
k
+
1
=
t
k
+
h
,
for
k
=
0
,
1
, . . . ,
N

1
.
Notice that
t
N
=
b
and the other
t
k
sodefined 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
=
0 to
N

1
t
k
+
1
=
t
k
+
h
y
k
+
1
=
y
k
+
h f
(
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
fixedstep
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 floating 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
satisfies 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 first power in the error bound is the reason that we say that
Euler’s method is a
firstorder
method.
Systems
Euler’s method carries over directly to systems of firstorder
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
defined as above, we have
for
k
=
0 to
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!