NAG Library Routine Document
d01paf
(md_simplex)
1
Purpose
d01paf returns a sequence of approximations to the integral of a function over a multidimensional simplex, together with an error estimate for the last approximation.
2
Specification
Fortran Interface
Integer, Intent (In) | :: |
ndim,
ldvert,
sdvert,
maxord | Integer, Intent (Inout) | :: |
minord,
ifail | Real (Kind=nag_wp), External | :: |
functn | Real (Kind=nag_wp), Intent (Inout) | :: |
vert(ldvert,sdvert),
finvls(maxord) | Real (Kind=nag_wp), Intent (Out) | :: |
esterr |
|
C Header Interface
#include nagmk26.h
void |
d01paf_ (
const Integer *ndim,
double vert[],
const Integer *ldvert,
const Integer *sdvert,
double (NAG_CALL *functn)(
const Integer *ndim,
const double x[]),
Integer *minord,
const Integer *maxord,
double finvls[],
double *esterr,
Integer *ifail) |
|
3
Description
d01paf 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).
4
References
de Doncker E (1979) New Euler–Maclaurin Expansions and their application to quadrature over the -dimensional simplex Math. Comput. 33 1003–1018
Grundmann A and Moller H M (1978) Invariant integration formulas for the -simplex by combinatorial methods SIAM J. Numer. Anal. 15 282–290
5
Arguments
- 1: – IntegerInput
-
On entry: , the number of dimensions of the integral.
Constraint:
.
- 2: – Real (Kind=nag_wp) arrayInput/Output
-
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
d01paf.
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
d01paf is made with
. In particular
contains the volume of the simplex.
- 3: – IntegerInput
-
On entry: the first dimension of the array
vert as declared in the (sub)program from which
d01paf is called.
Constraint:
.
- 4: – IntegerInput
-
On entry: the second dimension of the array
vert as declared in the (sub)program from which
d01paf is called.
Constraint:
.
- 5: – real (Kind=nag_wp) Function, supplied by the user.External Procedure
-
functn must return the value of the integrand
at a given point.
The specification of
functn is:
Fortran Interface
Function functn ( |
ndim,
x) |
Real (Kind=nag_wp) | :: | functn | Integer, Intent (In) | :: |
ndim | Real (Kind=nag_wp), Intent (In) | :: |
x(ndim) |
|
C Header Interface
#include nagmk26.h
double |
functn (
const Integer *ndim,
const double x[]) |
|
- 1: – IntegerInput
-
On entry: , the number of dimensions of the integral.
- 2: – Real (Kind=nag_wp) arrayInput
-
On entry: the coordinates of the point at which the integrand must be evaluated.
functn must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which
d01paf is called. Arguments denoted as
Input must
not be changed by this procedure.
Note: functn should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by
d01paf. If your code inadvertently
does return any NaNs or infinities,
d01paf is likely to produce unexpected results.
- 6: – IntegerInput/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
d01paf.
Constraint:
.
On exit: .
- 7: – IntegerInput
-
On entry: the highest order of approximation to the integral to be computed.
Constraint:
.
- 8: – Real (Kind=nag_wp) arrayInput/Output
-
On entry: if , must contain approximations to the integral previously computed by d01paf.
On exit: contains these values unchanged, and the newly computed values . is an approximation to the integral of polynomial degree .
- 9: – Real (Kind=nag_wp)Output
-
On exit: an absolute error estimate for .
- 10: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this argument, the recommended value is
.
When the value is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
-
The volume of the simplex integration region is too large or too small to be represented on the machine.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.9 in How to Use the NAG Library and its Documentation for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.8 in How to Use the NAG Library and its Documentation for further information.
Dynamic memory allocation failed.
See
Section 3.7 in How to Use the NAG Library and its Documentation for further information.
7
Accuracy
An absolute error estimate is output through the argument
esterr.
8
Parallelism and Performance
d01paf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
d01paf 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 routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
The running time for
d01paf will usually be dominated by the time used to evaluate the integrand
functn. The maximum time that could be used by
d01paf will be approximately given by
where
is the time needed for one call of
functn.
10
Example
This example demonstrates the use of the subroutine with the integral
10.1
Program Text
Program Text (d01pafe.f90)
10.2
Program Data
None.
10.3
Program Results
Program Results (d01pafe.r)