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.

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 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)

In this example, the f-values are generated from a known function

f = 0.2 + 25x- 200x2 + 675x3 - 900x4 + 400x5

which allows the determination of an exact solution. A comparison of methods yields the following results:

  • The Multiple Application Trapezoid Method yields: 1.5648
  • The Multiple Application Simpson’s Method yields: 1.6036
  • INT_TABULATED yields: 1.6232

The exact solution (4 decimal accuracy) is: 1.6405


Result = INT_TABULATED( X, F [, /DOUBLE] [, /SORT] )

Return Value

Returns the area under the curve represented by the function.



The tabulated single- or double-precision floating-point X-value data. Data may be irregularly gridded and in random order. (If the data is randomly ordered, set the SORT keyword.)

Each X value must be unique; if duplicate X values are detected, the routine will exit and display a warning message.

Note: X is returned modified if SORT is set.


The tabulated single- or double-precision floating-point F-value data. Upon input to the function, Xi and Fi must have corresponding indices for all values of i. If X is reordered, F is also reordered.

Note: F is returned modified if SORT is set.



Set this keyword to force the computation to be done in double-precision arithmetic.


Set this keyword to sort the tabulated x-value data into ascending order. If SORT is set, both X and F values are returned sorted.

Version History

Pre 4.0


See Also