nag_quad_md_simplex (d01pac) returns a sequence of approximations to the integral of a function over a multidimensional simplex, together with an error estimate for the last approximation.
nag_quad_md_simplex (d01pac) computes a sequence of approximations
, for
, to an integral
where
is an
-dimensional simplex defined in terms of its
vertices.
is an approximation which will be exact (except for rounding errors) whenever the integrand is a polynomial of total degree
or less.
The type of method used has been described in
Grundmann and Moller (1978), and is implemented in an extrapolated form using the theory from
de Doncker (1979).
de Doncker E (1979) New Euler–Maclaurin Expansions and their application to quadrature over the -dimensional simplex Math. Comput. 33 1003–1018
- 1:
– IntegerInput
-
On entry: , the number of dimensions of the integral.
Constraint:
.
- 2:
– doubleInput/Output
-
Note: the dimension,
dim, of the array
vert
must be at least
.
Where appears in this document, it refers to the array element
.
On entry:
must be set to the
th component of the
th vertex for the simplex integration region, for
and
. If
,
vert must be unchanged since the previous call of nag_quad_md_simplex (d01pac).
On exit: these values are unchanged. The rest of the array
vert is used for workspace and contains information to be used if another call of nag_quad_md_simplex (d01pac) is made with
. In particular
contains the volume of the simplex.
- 3:
– function, supplied by the userExternal Function
-
functn must return the value of the integrand
at a given point.
The specification of
functn is:
double |
functn (Integer ndim,
const double x[],
Nag_Comm *comm)
|
|
- 1:
– IntegerInput
-
On entry: , the number of dimensions of the integral.
- 2:
– const doubleInput
-
On entry: the coordinates of the point at which the integrand must be evaluated.
- 3:
– Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to
functn.
- user – double *
- iuser – Integer *
- p – Pointer
The type Pointer will be
void *. Before calling nag_quad_md_simplex (d01pac) you may allocate memory and initialize these pointers with various quantities for use by
functn when called from nag_quad_md_simplex (d01pac) (see
Section 3.2.1.1 in the Essential Introduction).
- 4:
– Integer *Input/Output
-
On entry: must specify the highest order of the approximations currently available in the array
finvls.
indicates an initial call;
indicates that
have already been computed in a previous call of nag_quad_md_simplex (d01pac).
Constraint:
.
On exit: .
- 5:
– IntegerInput
-
On entry: the highest order of approximation to the integral to be computed.
Constraint:
.
- 6:
– doubleInput/Output
-
On entry: if , must contain approximations to the integral previously computed by nag_quad_md_simplex (d01pac).
On exit: contains these values unchanged, and the newly computed values . is an approximation to the integral of polynomial degree .
- 7:
– double *Output
-
On exit: an absolute error estimate for .
- 8:
– Nag_Comm *
-
The NAG communication argument (see
Section 3.2.1.1 in the Essential Introduction).
- 9:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.6 in the Essential Introduction).
An absolute error estimate is output through the argument
esterr.
nag_quad_md_simplex (d01pac) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_quad_md_simplex (d01pac) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The running time for nag_quad_md_simplex (d01pac) will usually be dominated by the time used to evaluate the integrand
functn. The maximum time that could be used by nag_quad_md_simplex (d01pac) will be approximately given by
where
is the time needed for one call of
functn.
This example demonstrates the use of the function with the integral
None.