SINGLE-STEP AND
RUNGE-KUTIA
METHODS 431
Table 6.27
Example of the
R.KF
method
X
Yh(x)
Y(x)-
Yh(x)
Y(x)-
Y2h(x)
Ratio
f5-[yh(x)-
Y2h(x)]
2.0
.40000881
-8.8E-
6
-5.0E-
4
57
-3.3E-
5
4.0
.23529469
-5.8E-
7
-4.0E-
5
69
-2.6E-
6
6.0
.16216226
-9.5E-
8
-7.9E-
6
83
-5.2E-
7
8.0
.12307695
-2.6E-
8
-2.5E-
6
95
-1.6E-
7
10.0
.09900991
-9.4E-
9
-l.OE-
6
106
-6.6E-
8
The
truncation errors for (6.10.41) and (6.10.21) are, respectively,
RKF(6.10.41):
T,+
1
(Y)
~
.00048h
5
RK
(6.10.21):
Tn+l
(Y)
~
- .0083h
5
n
~
0
This suggests that the
RKF
method should generally have a smaller truncation
error, although in practice, the difference is generally
not
tliis great. Note that the
classical method (6.10.21) with a stepsize
h and using the error estimate (6.10.37)
will require eleven evaluations
off
to go from Yh(xn) to Yh(xn + 2h). And the
RFK
method (6.10.41) will require twelve evaluations to go from Yh(xn)
to
yh(xn + 2h). Consequently, the computational effort in going from xn to xn +
2h
is comparable, and
it
is fair to compare their errors
by
using the same value of h.
Example
Use the
RKF
method (6.10.41) to solve the problem (6.10.22).
It
was
previously
an
example for the classical
RK
method (6.10.21). As before, h = .25;
and
the results are given in Table 6.27. The theoretical value for Ratio is again
16, and clearly it has
not
yet settled down to that value. As h decreases,
it
approaches 16 more closely. The use of the Richardson extrapolation formula
(6.10.24) is given in the last column, and
it
clearly overestimates the error.
Nonetheless, this is still a useful error estimate
in
that
it
gives some idea
of
the
magnitude
of
the global error.
The
method (6.10.41) and (6.10.42) is generally used with local extrapolation,
as is illustrated later. The method has been much studied, to see whether
improvements were possible. Recently, Shampine (1986) has given an analysis
that suggests some improved
RKF
formulas, based on several criteria for
comparing
Runge-Kutta
formulas. To date, these have
not
been made a
part
of
a
high-quality production computer code, although
it
is expected they will be.
Automatic Runge-Kutta-Fehlberg programs A variable-stepsize
RKF
program
can
be
written
by
using (6.10.43) to estimate
and
control the truncation error
in
the fourth-order formula (6.10.41). Such a method has been written by L.
Shampine
and
H. Watts, and
it
is described in Shampine and Watts (1976a). Its
general features are
as
follows. The program is
named
RKF45, and a user
of
the
program must specify two error parameters ABSERR and RELERR. The trunca-
tion error
in
(6.10.43) for
Yn+l
is forced to satisfy the error per step criterion
jtruncjj
~
ABSERR +
RELERR•
IYn,)
(6.10.44)