BALL_VOLUME_QUAD is a FORTRAN90 program which investigates the behavior of a quadrature rule when it is applied to the characteristic function of the unit M-dimensional hyperball, which is a discontinuous function.

The program integrates the function over the unit hypercube [-1,+1]^M, where the spatial dimension M is arbitrary. The value of M is inferred from the user input quadrature rule information.

The problem used as example input to the program works in M = 6 dimensions. In that case, the volume of the hypercube is 64; the volume of the hyperball is pi^3/6, or about 5.16771.

Because the integrand is discontinuous, any quadrature rule based on the idea of interpolation will probably be unable to do a good job. A family of quadrature rules, which rely on increasing the order of interpolation to improve accuracy, will probably get increasingly bad answers.

By contrast, a basic Monte Carlo rule, which assumes nothing about the function, integrates this function just as well as it integrates most any other square-integrable function. (That's both the strength and weakness of the blunt instrument we call Monte Carlo integration.)

The program assumes that the quadrature rule is defined by three text files.

### Usage:

where
• prefix_r.txt contains the coordinates of two points that define the quadrature region.
• prefix_w.txt contains the weights;
• prefix_x.txt contains the points;
For information on the form of these files, see the QUADRATURE_RULES directory listed below.

### Related Data and Programs:

BALL_VOLUME_MONTE_CARLO, a FORTRAN90 program which applies a Monte Carlo method to estimate the volume of the unit 6D sphere;

NINTLIB, a FORTRAN90 library which numerically estimates integrals in multiple dimensions.

QUADRATURE_RULES, a dataset directory which contains sets of files that define quadrature rules over various 1D intervals or multidimensional hypercubes.

STROUD, a FORTRAN90 library which defines quadrature rules for a variety of unusual areas, surfaces and volumes in 2D, 3D and multiple dimensions.

TEST_NINT, a FORTRAN90 library which defines integrand functions for testing multidimensional quadrature routines.

TESTPACK, a FORTRAN90 library which defines a set of integrands used to test multidimensional quadrature.

### Reference:

1. Philip Davis, Philip Rabinowitz,
Methods of Numerical Integration,
Second Edition,
Dover, 2007,
ISBN: 0486453391,
LC: QA299.3.D28.

### List of Routines:

• MAIN is the main program for BALL_VOLUME_QUAD.
• CH_CAP capitalizes a single character.
• CH_EQI is a case insensitive comparison of two characters for equality.
• CH_TO_DIGIT returns the integer value of a base 10 digit.
• FILE_COLUMN_COUNT counts the number of columns in the first line of a file.
• FILE_ROW_COUNT counts the number of row records in a file.
• GET_UNIT returns a free FORTRAN unit number.