IMSL_INTFCN_QMC

Syntax | Return Value | Arguments | Keywords | Discussion | Example | Version History

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

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

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:

IMSL_INTFCN_QMC-42.jpg

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 an array of data points at which the function is to be evaluated and returns the scalar value of the function.

a

A vector specifying the lower limit of integration.

b

A vector specifying the upper limit of integration.

Keywords

BASE

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

DOUBLE

Set this keyword to perform computations using double precision.

ERR_ABS

Set this keyword to a value specifying the accuracy desired. Default: ERR_ABS=1 × e-4.

ERR_EST

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

ERR_REL

Set this keyword to a value specifying the relative accuracy desired. Default: ERR_REL=1 × e-4.

MAX_EVALS

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

SKIP

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

Discussion

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

Version History

6.4

Introduced