We will not here consider the problem of interpolating on a mesh that is not Cartesian, ., has tabulated function values at “random” points in n-dimensional space rather than at the vertices of a rectangular array. For clarity, we will consider explicitly only the case of two dimensions, the cases of three or more dimensions being analogous in every way. In two dimensions, we imagine that we are given a matrix of functional values ya[1m][1n]. We are also given an array x1a[1m], and an array x2a[1n]. The relation of these input quantities to an underlying function y(x1 , x2 ). | 136 Chapter4. Integration ofFunctions 1 1 1 N 1 2 3 --------------------------------- ---------------------------------------------------------------- ----------------------------------------------------------------- ------------------------------------------------------------------ ---------------------------------1 4 --------- ------- --------- -------- --------- -------- -------- --------- total after N 4 Figure . Sequential calls to the routine trapzd incorporate the information from previous calls and evaluate the integrand only at those new points necessary to refine the grid. The bottom line shows the totality of function evaluations after the fourth call. The routine qsimp by weighting the intermediate results transforms the trapezoid rule into Simpson s rule with essentially no additional overhead. There are also formulas of higher order for this situation but we will refrain from giving them. The semi-open formulas are just the obvious combinations of equations with - respectively. At the closed end of the integration use the weights from the former equations at the open end use the weights from the latter equations. One example should give the idea the formula with error term decreasing as 1 N3 which is closed on the right and open on the left X J X1 f x dx h 23 7 12 f2 12 f3 f4 f5 13 . 5 fN-2 12 fN-1 12 fN CITED REFERENCES AND FURTHER READING Abramowitz M. and Stegun . 1964 Handbook of Mathematical Functions Applied Mathematics Series Volume 55 Washington National Bureau of Standards reprinted 1968 by Dover Publications New York . 1 Isaacson E. and Keller . 1966 Analysis of Numerical Methods New York Wiley . Elementary Algorithms Our starting point is equation the extended trapezoidal rule. There are two facts about the trapezoidal rule which make it the starting point for a variety of algorithms. One fact is rather obvious while the second is rather deep. The obvious fact is that for a .