Appendix E

A Detailed Look at f

Section 14, Numerical Integration, presented the basic information you need to use f This appendix discusses more intricate aspects of f that are of interest if you use foften.

How fWorks

The falgorithm calculates the integral of a function f(x) by computing a weighted average of the function's values at many values of x (known as sample points) within the interval of integration. The accuracy of the result of any such sampling process depends on the number of sample points considered: generally, the more sample points, the greater the accuracy. If f(x) could be evaluated at an infinite number of sample points, the algorithm could – neglecting the limitation imposed by the inaccuracy in the calculated function f(x) – provide an exact answer.

Evaluating the function at an infinite number of sample points would take a very long time (namely, forever). However, this is not necessary, since the maximum accuracy of the calculated integral is limited by the accuracy of the calculated function values. Using only a finite number of sample points, the algorithm can calculate an integral that is as accurate as is justified considering the inherent uncertainty in f(x).

The f algorithm at first considers only a few sample points, yielding relatively inaccurate approximations. If these approximations are not yet as accurate as the accuracy of f(x) would permit, the algorithm is iterated (that is, repeated) with a larger number of sample points. These iterations continue, using about twice as many sample points each time, until the resulting approximation is as accurate as is justified considering the inherent uncertainty in f(x).

240