nag_quad_md_simplex (d01pac) (PDF version)
d01 Chapter Contents
d01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_quad_md_simplex (d01pac)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

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.

2  Specification

#include <nag.h>
#include <nagd01.h>
void  nag_quad_md_simplex (Integer ndim, double vert[],
double (*functn)(Integer ndim, const double x[], Nag_Comm *comm),
Integer *minord, Integer maxord, double finvls[], double *esterr, Nag_Comm *comm, NagError *fail)

3  Description

nag_quad_md_simplex (d01pac) 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).

4  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

5  Arguments

1:     ndim IntegerInput
On entry: n, the number of dimensions of the integral.
Constraint: ndim2.
2:     vert[dim] doubleInput/Output
Note: the dimension, dim, of the array vert must be at least 2×ndim+1×ndim+1.
Where VERTi,j appears in this document, it refers to the array element vert[j-1×ndim+1+i-1].
On entry: VERTi,j 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 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 minord>0. In particular VERTn+1,2n+2 contains the volume of the simplex.
3:     functn function, supplied by the userExternal Function
functn must return the value of the integrand f at a given point.
The specification of functn is:
double  functn (Integer ndim, const double x[], Nag_Comm *comm)
1:     ndim IntegerInput
On entry: n, the number of dimensions of the integral.
2:     x[ndim] const doubleInput
On entry: the coordinates of the point at which the integrand f must be evaluated.
3:     comm Nag_Comm *
Pointer to structure of type Nag_Comm; the following members are relevant to functn.
userdouble *
iuserInteger *
pPointer 
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 2.3.1.1 in How to Use the NAG Library and its Documentation).
4:     minord Integer *Input/Output
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 nag_quad_md_simplex (d01pac).
Constraint: minord0.
On exit: minord=maxord.
5:     maxord IntegerInput
On entry: the highest order of approximation to the integral to be computed.
Constraint: maxord>minord.
6:     finvls[maxord] doubleInput/Output
On entry: if minord>0, finvls[0],finvls[1],,finvls[minord-1] 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 finvls[minord],finvls[minord+1],,finvls[maxord-1]. finvls[j-1] is an approximation to the integral of polynomial degree 2j-1.
7:     esterr double *Output
On exit: an absolute error estimate for finvls[maxord-1].
8:     comm Nag_Comm *
The NAG communication argument (see Section 2.3.1.1 in How to Use the NAG Library and its Documentation).
9:     fail NagError *Input/Output
The NAG error argument (see Section 2.7 in How to Use the NAG Library and its Documentation).

6  Error Indicators and Warnings

NE_ACCURACY
The volume of the simplex integration region is too large or too small to be represented on the machine.
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, minord=value.
Constraint: minord0.
On entry, ndim=value.
Constraint: ndim2.
NE_INT_2
On entry, maxord=value and minord=value.
Constraint: maxord>minord.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 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

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.

9  Further Comments

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
T×maxord+ndim! maxord-1!ndim+1!  
where T is the time needed for one call of functn.

10  Example

This example demonstrates the use of the function with the integral
01 01-x 01-x-y expx+y+z cosx+y+z dz dy dx = 14 .  

10.1  Program Text

Program Text (d01pace.c)

10.2  Program Data

None.

10.3  Program Results

Program Results (d01pace.r)


nag_quad_md_simplex (d01pac) (PDF version)
d01 Chapter Contents
d01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2016