8.2 Population Growth: A First Order ODE
215
is constant. This property implies that
t n = nΔt, n = 0, 1, . . . , N t .
Second, the differential equation is supposed to hold at the mesh points. Note that
this is an approximation, because the differential equation is originally valid for all
real values of t. We can express this property mathematically as
u
(t n ) = f (u
n , t n ), n = 0, 1, . . . , N t .
For example, with our model equation u = ru, we have the special case
u
(t n ) = ru
n , n = 0, 1, . . . , N t ,
or
u
(t n ) = r(t n )u
n , n = 0, 1, . . . , N t ,
if r depends explicitly on t.
Third, derivatives are to be replaced by finite differences. To this end, we
need to know specific formulas for how derivatives can be approximated by finite
differences. One simple possibility is to use the definition of the derivative from any
calculus book,
u
(t) = lim
Δt →0
u(t + Δt) − u(t)
Δt
.
At an arbitrary mesh point t n this definition can be written as
u
(t n ) = lim
Δt →0
u n+1 − u n
Δt
.
Instead of going to the limit Δt → 0 we can use a small Δt, which yields a
computable approximation to u (t n ):
u
(t n ) ≈
u n+1 − u n
Δt
.
This is known as a forward difference since we go forward in time (u n+1 ) to collect
information in u to estimate the derivative. Figure 8.4 illustrates the idea. The error
of the forward difference is proportional to Δt (often written as O(Δt), but we will
not use this notation in the present book).
We can now plug in the forward difference in our differential equation sampled
at the arbitrary mesh point t n :
u n+1 − u n
Δt
= f (u
n , t n ),
(8.3)
215
is constant. This property implies that
t n = nΔt, n = 0, 1, . . . , N t .
Second, the differential equation is supposed to hold at the mesh points. Note that
this is an approximation, because the differential equation is originally valid for all
real values of t. We can express this property mathematically as
u
(t n ) = f (u
n , t n ), n = 0, 1, . . . , N t .
For example, with our model equation u = ru, we have the special case
u
(t n ) = ru
n , n = 0, 1, . . . , N t ,
or
u
(t n ) = r(t n )u
n , n = 0, 1, . . . , N t ,
if r depends explicitly on t.
Third, derivatives are to be replaced by finite differences. To this end, we
need to know specific formulas for how derivatives can be approximated by finite
differences. One simple possibility is to use the definition of the derivative from any
calculus book,
u
(t) = lim
Δt →0
u(t + Δt) − u(t)
Δt
.
At an arbitrary mesh point t n this definition can be written as
u
(t n ) = lim
Δt →0
u n+1 − u n
Δt
.
Instead of going to the limit Δt → 0 we can use a small Δt, which yields a
computable approximation to u (t n ):
u
(t n ) ≈
u n+1 − u n
Δt
.
This is known as a forward difference since we go forward in time (u n+1 ) to collect
information in u to estimate the derivative. Figure 8.4 illustrates the idea. The error
of the forward difference is proportional to Δt (often written as O(Δt), but we will
not use this notation in the present book).
We can now plug in the forward difference in our differential equation sampled
at the arbitrary mesh point t n :
u n+1 − u n
Δt
= f (u
n , t n ),
(8.3)
