The IMSL_INTFCN_QMC function integrates a function on a hyper-rectangle using a quasi-Monte Carlo method.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

Integration of functions over hypercubes by direct methods, such as IMSL_INTFCNHYPER, is practical only for fairly low dimensional hypercubes. This is because the amount of work required increases exponential as the dimension increases.

An alternative to direct methods is Monte Carlo, in which the integral is evaluated as the value of the function averaged over a sequence of randomly chosen points. Under mild assumptions on the function, this method will converge like 1/n1/2, where n is the number of points at which the function is evaluated.

It is possible to improve on the performance of Monte Carlo by carefully choosing the points at which the function is to be evaluated. Randomly distributed points tend to be non-uniformly distributed. The alternative to at sequence of random points is a low-discrepancy sequence. A low-discrepancy sequence is one that is highly uniform.

This function is based on the low-discrepancy Faure sequence, as computed by IMSL_FAURE_NEXT_PT.

Example


FUNCTION F, x
S = 0.0
sign = -1.0
FOR i = 0, N_ELEMENTS(x)-1 DO BEGIN
  prod = 1.0
  FOR j = 0, i DO BEGIN
    prod = prod*x(j)
  END
  S = S + sign*prod
  sign = -sign
END
RETURN, s
END
ndim = 10
a = FLTARR(ndim)
a(*) = 0
b = FLTARR(ndim)
b(*) = 1
result = IMSL_INTFCN_QMC( 'f', a, b)
PM, result

IDL prints:

-0.333010

Syntax


Result = IMSL_INTFCN_QMC(F, A, B [, BASE=value] [, /DOUBLE] [, ERR_ABS=value] [, ERR_EST=variable] [, ERR_REL=value] [, MAX_EVALS=value] [, SKIP=value])

Return Value


The value of:

is returned. If no value can be computed, the floating-point value NaN (Not a Number) is returned.

Arguments


F

A scalar string specifying the name of a user-supplied function to be integrated. The function f accepts one scalar parameter and returns a single scalar of the same type.

A

A scalar expression specifying the lower limit of integration.

B

A scalar expression specifying the upper limit of integration.

Keywords


BASE (optional)

Set this keyword to the value of BASE used to compute the Faure sequence.

DOUBLE (optional)

Set this keyword to perform computations using double precision.

ERR_ABS (optional)

Set this keyword to a value specifying the accuracy desired. The default value is 1 × e-4.

ERR_EST (optional)

Set this keyword to a named variable that will contain an estimate of the absolute value of the error.

ERR_REL (optional)

Set this keyword to a value specifying the relative accuracy desired. The default value is 1 × e-4.

MAX_EVALS (optional)

Set this keyword to the number of evaluations allowed. If MAX_EVALS is not supplied, the number of evaluations is unlimited.

SKIP (optional)

Set this keyword to the value of SKIP used to compute the Faure sequence.

Version History


6.4

Introduced

See Also


IMSL_INTFCNHYPER