d01pa returns a sequence of approximations to the integral of a function over a multidimensional simplex, together with an error estimate for the last approximation.

Syntax

C#
public static void d01pa(
	int ndim,
	double[,] vert,
	D01..::..D01PA_FUNCTN functn,
	ref int minord,
	int maxord,
	double[] finvls,
	out double esterr,
	out int ifail
)
Visual Basic
Public Shared Sub d01pa ( _
	ndim As Integer, _
	vert As Double(,), _
	functn As D01..::..D01PA_FUNCTN, _
	ByRef minord As Integer, _
	maxord As Integer, _
	finvls As Double(), _
	<OutAttribute> ByRef esterr As Double, _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void d01pa(
	int ndim, 
	array<double,2>^ vert, 
	D01..::..D01PA_FUNCTN^ functn, 
	int% minord, 
	int maxord, 
	array<double>^ finvls, 
	[OutAttribute] double% esterr, 
	[OutAttribute] int% ifail
)
F#
static member d01pa : 
        ndim : int * 
        vert : float[,] * 
        functn : D01..::..D01PA_FUNCTN * 
        minord : int byref * 
        maxord : int * 
        finvls : float[] * 
        esterr : float byref * 
        ifail : int byref -> unit 

Parameters

ndim
Type: System..::..Int32
On entry: n, the number of dimensions of the integral.
Constraint: ndim2.
vert
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, sdvert]
Note: dim1 must satisfy the constraint: dim1ndim+1
On entry: vert[i-1,j-1] must be set to the jth component of the ith vertex for the simplex integration region, for i=1,2,,n+1 and j=1,2,,n. If minord>0, vert must be unchanged since the previous call of d01pa.
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 d01pa is made with minord>0. In particular vert[n,2n+1] contains the volume of the simplex.
functn
Type: NagLibrary..::..D01..::..D01PA_FUNCTN
functn must return the value of the integrand f at a given point.

A delegate of type D01PA_FUNCTN.

minord
Type: System..::..Int32%
On entry: must specify the highest order of the approximations currently available in the array finvls. minord=0 indicates an initial call; minord>0 indicates that finvls[0],finvls[1],,finvls[minord-1] have already been computed in a previous call of d01pa.
Constraint: minord0.
On exit: minord=maxord.
maxord
Type: System..::..Int32
On entry: the highest order of approximation to the integral to be computed.
Constraint: maxord>minord.
finvls
Type: array<System..::..Double>[]()[][]
An array of size [maxord]
On entry: if minord>0, finvls[0],finvls[1],,finvls[minord-1] must contain approximations to the integral previously computed by d01pa.
On exit: contains these values unchanged, and the newly computed values finvls[minord],finvls[minord+1],,finvls[maxord-1]. finvls[j-1] is an approximation to the integral of polynomial degree 2j-1.
esterr
Type: System..::..Double%
On exit: an absolute error estimate for finvls[maxord-1].
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

d01pa computes a sequence of approximations finvls[j-1], for j=minord+1,,maxord, to an integral
Sfx1,x2,,xndx1dx2dxn
where S is an n-dimensional simplex defined in terms of its n+1 vertices. finvls[j-1] is an approximation which will be exact (except for rounding errors) whenever the integrand is a polynomial of total degree 2j-1 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).

References

de Doncker E (1979) New Euler–Maclaurin Expansions and their application to quadrature over the s-dimensional simplex Math. Comput. 33 1003–1018
Grundmann A and Moller H M (1978) Invariant integration formulas for the n-simplex by combinatorial methods SIAM J. Numer. Anal. 15 282–290

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDVERT) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry, ldvert=value and ndim=value.
Constraint: ldvertndim+1.
On entry, maxord=value and minord=value.
Constraint: maxord>minord.
On entry, minord=value.
Constraint: minord0.
On entry, ndim=value.
Constraint: ndim2.
On entry, sdvert=value and ndim=value.
Constraint: sdvert2×ndim+1.
ifail=2
The volume of the simplex integration region is too large or too small to be represented on the machine.
ifail=-999
Dynamic memory allocation failed.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

An absolute error estimate is output through the parameter esterr.

Parallelism and Performance

None.

Further Comments

The running time for d01pa will usually be dominated by the time used to evaluate the integrand functn. The maximum time that could be used by d01pa will be approximately given by
T×maxord+ndim!maxord-1!ndim+1!
where T is the time needed for one call of functn.

Example

This example demonstrates the use of the method with the integral
0101-x01-x-yexpx+y+zcosx+y+zdzdydx=14.

Example program (C#): d01pae.cs

Example program results: d01pae.r

See Also