
AUTOMATIC 
NUMERICAL 
INTEGRATION 
299 
12. 
If 
iRk-
Rk-d 
> t:,  then go to step 3 
13. 
Since 
IRk-
Rk_Ji 
.:::;; 
t:,  accept 
int 
= 
Rk-l 
and n;turn. 
There are many variants of Romberg integration. 
For 
example, other ways 
of 
increasing the number of nodes have been studied. 
For 
a very complete survey 
of 
the  literature  on  Romberg  integration,  see  Davis 
and 
Rabinowitz  (1984,  pp. 
434-446). They also give a Fortran program for  Romberg integration. 
5.5  Automatic Numerical Integration 
An automatic numerical integration program calculates 
an 
approximate integral 
to within  an accuracy specified  by the user  of the program. The user  does  not 
need to specify either the method or the number 
of 
nodes to be used. There are 
some excellent automatic integration programs, 
and 
many people use them. Such 
a program saves you the time of writing your own program, and for many people, 
it avoids having to understand the needed numerical integration theory. Nonethe-
less,  it  is  almost  always  possible  to  improve 
upon 
an  automatic  program, 
although 
it 
usually 
~equires 
a  good  knowledge 
of 
the  numerical  integration 
needed  for  your  particular  problem.  When  doing  only  a  small  number 
of 
numerical integrations, automatic integration 
is 
often 
a good way  to save  time. 
But for problems involving many integrations, it is probably better to invest the 
time to find  a less  expensive numerical integration procedure. 
An  automatic  numerical  integration  program  functions  as  a 
"black 
box," 
without  the user  being  able  to  see  the  intermediate steps 
of 
the computation. 
Because 
of 
this,  the most important characteristic 
of 
such a program is  that it be 
reliable: The approximate integral that is  returned 
by 
the program and that the 
program says satisfies the user's error tolerance must, in fact, be that accurate. In 
theory, no such algorithm exists, 
as 
we 
explain in 
the 
next paragraph. But for the 
type of integrands that one usually considers in practice, there are programs that 
have a high order of reliability. This reliability will 
be 
improved if the user reads 
the program description, to see the restrictions 
and 
assumptions of the program. 
To understand the  theoretical impossibility 
of 
a: 
perfectly reliable  automatic 
integration program, note that the program will  evaluate the integrand 
j(x) 
at 
only  a  finite  number 
of 
points,  say  x
1
, 
••. 
, 
xn-
Then 
there  are  an  infinity  of 
continuous functions 
/(x) 
for which 
/-(x;) = f(x;) 
i  = 1, 
... 
, n 
and 
In 
fact, there are an infinity of such functions 
/(x) 
that 
are infinitely differentia-