MONTE_CARLO_RULE Monte Carlo Sampling Regarded as Quadrature Rule

MONTE_CARLO_RULE is a FORTRAN90 program which generates a dataset of N random M-dimensional points, regards it as a quadrature rule for the unit hypercube, and writes out three files of information.

Usage:

monte_carlo_rule m n s
where
• m is the spatial dimension;
• n is the number of points to generate;
• s is the initial seed value.

The data is written to three files:

• an "R" or "region" file, which lists two points that bound the region, which will be the unit hypercube.
• a "W" or "weight" file, which lists the weight for each abscissa. each weight will equal 1/N.
• an "X" or "abscissa" file, which lists the abscissas of the rule. These will simply be the N random points in the M-dimensional hypercube.

Languages:

MONTE_CARLO_RULE is available in a C version and a C++ version and a FORTRAN77 version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

ALPERT_RULE, a FORTRAN90 library which can set up an Alpert quadrature rule for functions which are regular, log(x) singular, or 1/sqrt(x) singular.

LINE_NCO_RULE, a FORTRAN90 library which computes a Newton Cotes Open (NCO) quadrature rule, using equally spaced points, over the interior of a line segment in 1D.

POWER_RULE, a FORTRAN90 program which constructs a power rule, that is, a product quadrature rule from identical 1D factor rules.

QUADRATURE_RULES_UNIFORM, a dataset directory which contains quadrature rules for M-dimensional unit cubes, based on a uniform pseudorandom sequence. stored as a file of abscissas, a file of weights, and a file of region limits.

SPARSE_GRID_CC_DATASET, a FORTRAN90 program which creates a Clenshaw-Curtis sparse grid and write the data to three files.

SPARSE_GRID_GL_DATASET, a FORTRAN90 program which creates a Gauss-Legendre sparse grid and write the data to three files.

SPARSE_GRID_HERMITE_DATASET, a FORTRAN90 program which creates a Gauss-Hermite sparse grid and write the data to three files.

SPARSE_GRID_LAGUERRE_DATASET, a FORTRAN90 program which creates a Gauss-Laguerre sparse grid and write the data to three files.

SPARSE_GRID_MIXED_DATASET, a FORTRAN90 program which creates a sparse grid dataset based on a mixture of 1D rules.

SPARSE_GRID_OPEN_DATASET, a FORTRAN90 program which creates a sparse grid dataset based on open rules (Fejer 2, Gauss-Patterson, Newton-Cotes-Open).

Reference:

1. Paul Bratley, Bennett Fox, Linus Schrage,
A Guide to Simulation,
Springer Verlag, pages 201-202, 1983.
2. Bennett Fox,
Algorithm 647: Implementation and Relative Efficiency of Quasirandom Sequence Generators,
ACM Transactions on Mathematical Software,
Volume 12, Number 4, pages 362-376, 1986.
3. Donald Knuth,
The Art of Computer Programming,
Volume 2: Seminumerical Algorithms,

List of Routines:

• MAIN is the main program for MONTE_CARLO_RULE.
• GET_UNIT returns a free FORTRAN unit number.
• R8MAT_UNIFORM_01 returns a unit pseudorandom R8MAT.
• R8MAT_WRITE writes an R8MAT file.
• S_BLANK_DELETE removes blanks from a string, left justifying the remainder.
• S_TO_I4 reads an integer value from a string.
• TIMESTAMP prints the current YMDHMS date as a time stamp.

You can go up one level to the FORTRAN90 source codes.

Last revised on 23 December 2011.