An Introduction to Numerical Methods in C++, Revised Edition

The problems discussed in this chapter are very closely related to the problems of interpolation. Data are presented to us, either as a discrete tabulation of some function, or as the result of observation, and it is required that these data be approximately differentiated or integrated. Essentially, the approach is to fit a suitable polynomial to the data, explicitly or implicitly, and to differentiate or integrate the polynomial. The problem is then to estimate the error. We begin with differentiation, and then consider various approximations to integration over a small interval. We consider only the case in which the data are presented in the form of a function. Finally, we develop composite formulae which enable us to integrate a function accurately over a large interval.
The first order Taylor approximation to a function f( x + h) is given by ( cf 3.7)
where ?( x) ? ( x, x + h). Dividing through by h we obtain
so that, if h is sufficiently small, a first approximation to f ?( x) is given by the well-known formula:
This is known as the first-order forward difference formula if h > 0. If h < 0, it is known as the first-order backward difference formula, which may alternatively be written:
In either case, no information is used about the function f except for its values at x and x