198 5 Numerical Solution of ODEs and DAEs
time. Equation (5.2) indicates that at the initial time, the state vector must
be equal to y
i
. We would like to find an approximate solution to ordinary
differential equations (5.1) in the interval t
i
≤ t ≤ t
f
.
The problem (5.1)-(5.2) is called an initial value problem, because the
solution to the differential equations (5.1) is specified at the initial time.
(This type of problem is distinct from two-point (or multi-point) boundary
value problem where the solution is specified at two (or more) points in the
interval t
i
≤ t ≤ t
f
). Throughout this text it is assumed that f(y, t) is
continuously differentiable, with respect to its arguments, along the solution
to the initial value problem.
5.1.1 The explicit Euler method
Let t
(0)
= t
i
and t
(1)
= t
(0)
+ h, where h is some small increment in the time.
In the algorithms developed below we call h the step size. In this section
we also let t
(k)
= t
(k−1)
+ h for k = 0, 1, 2, ···. Thus, t
(k)
represents a set of
discrete time points that are equally spaced. Later we will relax this condition
and allow nonuniform spacing of the time points t
(k)
.
Now let y(t
(k)
) be the exact solution to the initial value problem at time
t
(k)
. Then a Taylor series expansion of y(t
(k+1)
) about t
(k)
yields
y(t
(k+1)
) = y(t
(k)
) +
dy(t
(k)
)
dt
h +
d
2
y(t
(k)
)
dt
2
h
2
2
+ ··· (5.3)
= y(t
(k)
) + f(y(t
(k)
), t
(k)
)h +
df(y(t
(k)
), t
(k)
)
dt
h
2
2
+ ···.
Neglecting terms of order h
2
and higher we get an approximate solution to
the initial value problem at t
(k+1)
as the discretization formula
y
(k+1)
= y
(k)
+ f (y
(k)
, t
(k)
)h. (5.4)
Here, y
(k)
represents the numerical solution at time t
(k)
, i.e., y
(k)
≈ y(t
(k)
).
Another approach to deriving (5.4) is to approximate the derivative ˙y(t
(k)
)
using
˙y(t
(k)
) =
1
h
(y
(k+1)
− y
(k)
). (5.5)
Putting (5.5) into (5.1) with t = t
(k)
and y(t) = y
(k)
gives (5.4). The discrete
equation (5.5) is called the forward Euler formula, and (5.4) is called the
explicit Euler method.
Algorithm 5.1.1 uses the explicit Euler method to find the approximate
solution of the initial value problem (5.1)-(5.2). This algorithm computes the
approximate solution at N discrete time points t
(k)
, k = 1, 2, ···, N. Starting
with the initial condition y
(0)
= y(t
i
) the method marches forward using the