INT_TABULATED

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.

Calling Sequence

Result = INT_TABULATED( X, F )

Arguments

X

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

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

F

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.

Keywords

SORT

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

Example

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:

• The Multiple Application Trapezoid Method yields: 1.5648
• The Multiple Application Simpson's Method yields: 1.6036
• INT_TABULATED yields: 1.6271

The exact solution (4 decimal accuracy) is: 1.6405