integrateOverPolyhedron {polyhedralCubature}R Documentation

Multiple integral over a polyhedron

Description

Multiple integral over a convex polyhedron given by a set of linear inequalities. See the vignette for explanations and examples.

Usage

integrateOverPolyhedron(f, A, b)

Arguments

f

either a function, a spray polynomial, or a qspray polynomial; its number of variables must match the number of columns of the matrix A

A, b

matrix and vector defining the linear inequalities which must be in numeric mode or, for exactness, in character mode, with an integer or a fraction as each entry; if f is a qspray polynomial, then A and b will be converted to character mode if they are in numeric mode, with the function d2q

Value

There are three possible values: an output of adaptIntegrateSimplex if f is a function, an output of integrateSimplexPolynomial if f is a spray polynomial, or a character representing the value of the integral as a fraction if f is a qspray polynomial.

Examples

A <- rbind(
  c(-1, 0, 0), # -x
  c( 1, 0, 0), # x
  c( 0,-1, 0), # -y
  c( 1, 1, 0), # x+y
  c( 0, 0,-1), # -z
  c( 1, 1, 1)  # x+y+z
)
b <- c(
  5, 4,  # -5 < x < 4       <=> -x < 5  &  x < 4
  5, 3,  # -5 < y < 3-x     <=> -y < 5  &  x+y < 3
  10, 6  # -10 < z < 6-x-y  <=> -z < 10  &  x+y+z < 6
)
f <- function(x, y, z) {
  x*y + 5*cos(z)
}
integrateOverPolyhedron(f, A, b)

[Package polyhedralCubature version 1.1.0 Index]