The Richardson Procedure
In advanced books of numerical analysis the Romberg
quadrature is simply described as: "If we apply the Richardson extrapolation to
the trapez rule we get the Romberg quadrature".
We now reconstruct our computation along the lines of this approach, for two
reasons:
(1) It is better programming practice. It results in smaller algorithmic units
which can be more easily build together afterwards. In short, it supports
modularity, maintenance and reuse better.
(2) Our shift from secant to tangent type quadrature in the formula of the last
paragraph requires a rewriting of the procedure 'Romberg' anyway. So we now
extract the extrapolation procedure 'Richardson' from the procedure 'Romberg'.
Procedure 'Richardson' is an extrapolation procedure, which can be applied to an
arbitrary sequence. This sequence is still called f(n), but it is no 'integrand'
any more. Rather, in our context, it is an integration-rule.
########################################################
The calling arguments of procedure Richardson
f::procedure, # the function to extrapolate
ext::integer, # number of rows (of extrapolation steps)
cols::integer, # max. number of columns, 0 means all
dig::integer, # this number of digits should be used in the numerical
calculation
info::integer, # -1: use trueval and show the error = approx-trueval
# 0: no info (quiet) # 1: some info (terse)
# 2: show extrapolation table
trueval # will only be used in case
info = -1
#######################################################
Observe that the extrapolation array has only one dimension.