grnmol {SimplicialCubature} | R Documentation |
Grundmann-Moller integration of a function over a simplex
Description
Computes an approximation to the integral of a function f(x) over a simplex S. This is an R translation of the matlab function grnmol.m which was written by Alan Genz.
Usage
grnmol(f,V,s)
Arguments
f |
a (real-valued) function f that can be evaluated at all points in V. |
V |
a single simplex, specified by an (n x (n+1)) matrix. The columns V[,1],...,V[,n+1] are the vertices of the simplex. |
s |
a positive integer specifying the order of the rule used |
Details
The Grundmann-Moller algorithm approximates the integral of f(x) over the simplex
V. When f(x) is a polynomial, and s is large enough, the integral is exact.
This function is called by integrateSimplexPolynomial
.
Value
Q |
a vector of length s+1, with Q[i] the i-th degree approximate value of the integral |
nv |
number of function evaluations used |
References
See reference by Grundmann and Moller in SimplicialCubature-package
.
Examples
f <- function( x ) { x[1]^2*x[4]^5 }
grnmol( f, CanonicalSimplex(4), s=4 )