The INT_TABULATED function integrates a tabulated set of data { xi , fi } on the closed interval [MIN( x ) , MAX( x )], using a five-point Newton-Cotes integration formula.
CAUTION: Data that is highly oscillatory requires a sufficient number of samples for an accurate integral approximation.
This routine is written in the IDL language. Its source code can be found in the file
int_tabulated.pro
in the
lib
subdirectory of the IDL distribution.
Define 11 x -values on the closed interval [0.0 , 0.8]:
X = [0.0, .12, .22, .32, .36, .40, .44, .54, .64, .70, .80]
Define 11 f -values corresponding to xi :
F = [0.200000, 1.30973, 1.30524, 1.74339, 2.07490, 2.45600, $
2.84299, 3.50730, 3.18194, 2.36302, 0.231964]
result = INT_TABULATED(X, F) Integrate.
In this example, the f-values are generated from a known function
f = 0.2 + 25 x - 200 x 2 + 675 x 3 - 900 x 4 + 400 x 5
which allows the determination of an exact solution. A comparison of methods yields the following results: