NAG Library Function Document
nag_multid_quad_adapt (d01fcc) attempts to evaluate a multidimensional integral (up to 15 dimensions), with constant and finite limits,
to a specified relative accuracy, using an adaptive subdivision strategy.
||nag_multid_quad_adapt (Integer ndim,
const double a,
const double b,
const double x),
nag_multid_quad_adapt (d01fcc) evaluates an estimate of a multidimensional integral over a hyper-rectangle (i.e., with constant limits), and also an estimate of the relative error. You will need to set the relative accuracy required, supply the integrand as a function f
, and also set the minimum and maximum acceptable number of calls to f
The function operates by repeated subdivision of the hyper-rectangular region into smaller hyper-rectangles. In each subregion, the integral is estimated using a seventh-degree rule, and an error estimate is obtained by comparison with a fifth-degree rule which uses a subset of the same points. The fourth differences of the integrand along each coordinate axis are evaluated, and the subregion is marked for possible future subdivision in half along that coordinate axis which has the largest absolute fourth difference.
If the estimated errors, totalled over the subregions, exceed the requested relative error (or if fewer than minpts
calls to f
have been made), further subdivision is necessary, and is performed on the subregion with the largest estimated error, that subregion being halved along the appropriate coordinate axis.
The function will fail if the requested relative error level has not been attained by the time maxpts
calls to f
have been made.
nag_multid_quad_adapt (d01fcc) is based on the HALF subroutine developed by van Dooren and de Ridder (1976)
. It uses a different basic rule, described by Genz and Malik (1980)
Genz A C and Malik A A (1980) An adaptive algorithm for numerical integration over an N-dimensional rectangular region J. Comput. Appl. Math. 6 295–302
van Dooren P and de Ridder L (1976) An adaptive algorithm for numerical integration over an N-dimensional cube J. Comput. Appl. Math. 2 207–217
ndim – IntegerInput
On entry: the number of dimensions of the integral, .
f – function, supplied by the userExternal Function
must return the value of the integrand
at a given point.
The specification of f
f (Integer ndim,
const double x)
ndim – IntegerInput
On entry: the number of dimensions of the integral.
x[ndim] – const doubleInput
On entry: the coordinates of the point at which the integrand must be evaluated.
a[ndim] – const doubleInput
On entry: the lower limits of integration, , for .
b[ndim] – const doubleInput
On entry: the upper limits of integration, , for .
minpts – Integer *Input/Output
must be set to the minimum number of integrand evaluations to be allowed.
contains the actual number of integrand evaluations used by the function nag_multid_quad_adapt (d01fcc).
maxpts – IntegerInput
On entry: the maximum number of integrand evaluations to be allowed.
eps – doubleInput
: the relative error acceptable. When the solution is zero or very small relative accuracy may not be achievable but you may still set eps
to a reasonable value and check fail
finval – double *Output
On exit: the best estimate obtained for the integral.
acc – double *Output
: the estimated relative error in finval
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
On entry, while . These arguments must satisfy .
Dynamic memory allocation failed.
given to ndim
not valid. Correct range is
. Constraint: .
was too small to obtain the required accuracy.
On return, finval
contain estimates of the integral and the relative error, but acc
will be greater than eps
On entry, eps
must not be less than or equal to 0.0:
A relative error estimate is output through the argument acc
Execution time will usually be dominated by the time taken to evaluate the integrand f
, and hence the maximum time that could be taken will be proportional to maxpts
This example estimates the integral
The accuracy requested is one part in 10,000.
9.1 Program Text
Program Text (d01fcce.c)
9.2 Program Data
9.3 Program Results
Program Results (d01fcce.r)