Graphics Programs Reference
In-Depth Information
Wecouldalso control some gross measure of the error,such as the root-mean-square
errordefinedby
n
1
n
E ( h )
E i ( h )
=
(7.22)
i
=
1
where n is the number of first-order equations. Thenwe woulduse
E ( h )
e ( h )
=
(7.23)
for the errormeasure.Since the root-mean-squareerroriseasier to handle, we adopt
itfor our program.
Error control is achieved by adjusting the increment h so that the per-step error
e is approximately equaltoaprescribed tolerance
ε
. Noting that the truncation error
( h 5 ), weconcludethat
in the fourth-order formulais
O
h 1
h 2
5
e ( h 1 )
e ( h 2 )
(a)
Let us now suppose that we performedanintegration stepwith h 1 that resultedin
the error e ( h 1 ). The step size h 2 that we should have used can nowbeobtained from
Eq. (a) by setting e ( h 2 )
= ε
:
h 1
1 / 5
ε
e ( h 1 )
h 2 =
(b)
If h 2
h 1 , wecouldrepeat the integration stepwith h 2 , butsince the errorassociated
with h 1 was below the tolerance, that wouldbe awaste of aperfectlygoodresult.So
we accept the current step and try h 2 in the next step. On the other hand, if h 2 <
h 1 ,
we must scrap the current step and repeat it with h 2 .As Eq. (b) isonly an approxima-
tion, it is prudenttoincorporate a small margin of safety. In our program we use the
formula
9 h 1 ε
e ( h 1 )
1 / 5
h 2 =
0
.
(7.24)
Recall that e ( h ) applies to a single integration step; that is, it is ameasure of the local
truncation error. The all-important globaltruncation erroris duetotheaccumulation
of the localerrors.What should
ε
be set at in order to achieve aglobalerrorno greater
than
ε = ε global
will usuallybe adequate. If the numberintegration steps islarge, it is advisable to
decrease
ε global ? Since e ( h ) is a conservative estimate of the actualerror, setting
accordingly.
Is there any reason to use the nonadaptive methods at all? Usuallyno; however,
there arespecialcases where adaptive methods break down. For example, adaptive
methods generallydo not work if F ( x
ε
,
y )contains discontinuousfunctions.Because
Search WWH ::




Custom Search