Differentiation and integration are basic mathematical operations with a wide range of applications in various fields of science and engineering. Simple continuous algebraic or transcendental functions can be easily differentiated or integrated directly. However at times there are complicated continuous functions which are tedious to differentiate or integrate directly or in the case of experimental data, where tabulated values of variables are given in discrete form, direct methods of calculus are not applicable.

Numerical Differentiation and Integration are techniques which are used when we treat the function as a ‘black-box’ or when the differentiation and integration of the function is not possible analytically. The techniques approximates the functions into linear functions, each on a very tiny interval of the domain of the function. Piecewise linear approximation of a function is the very foundation of Calculus. When the intervals are infinitesimally small, the function looks like a straight line in each of the intervals. This is the basic idea of differentiation. When we put the intervals or ‘lines’ together and sum up the block areas, typically rectangles or trapezoids underneath, we have integration.  This concept is taken to the limit when we make the interval limit infinitesimally small. However in a computer, we are good to go with a good enough small approximation or small enough intervals, hence we call it numerical differentiation and integration.

In the following figure, the arrows are the linear approximation of the function in each interval. They look close enough to represent the slopes or the derivatives of the function in the intervals. Each block area underneath an arrow can be easily computed as they are basically a trapezoid. We can sum them up to get the definite integral of the function. The more sub-intervals that we have, the more accurate the numerical derivatives and the numerical integrals are.

Numerical Differentiation and Integration Example