Package 'multIntTestFunc'

Title: Provides Test Functions for Multivariate Integration
Description: Provides implementations of functions that can be used to test multivariate integration routines. The package covers six different integration domains (unit hypercube, unit ball, unit sphere, standard simplex, non-negative real numbers and R^n). For each domain several functions with different properties (smooth, non-differentiable, ...) are available. The functions are available in all dimensions n >= 1. For each function the exact value of the integral is known and implemented to allow testing the accuracy of multivariate integration routines. Details on the available test functions can be found at on the development website.
Authors: Klaus Herrmann [aut, cre]
Maintainer: Klaus Herrmann <[email protected]>
License: MIT + file LICENSE
Version: 0.3.0
Built: 2024-11-08 05:28:56 UTC
Source: https://github.com/klausherrmann/multinttestfunc

Help Index


Domain check for closed unit ball {xRn:x21}\{\vec{x} \in R^n : \Vert \vec{x} \Vert_{2} \leq 1\}

Description

The function checks if a point (one row in the input argument) is inside the closed unit ball {xRn:x21}\{\vec{x} \in R^n : \Vert \vec{x} \Vert_2 \leq 1\} or not. If the input matrix contains entries that are not numeric, i.e., not representing real numbers, the function throws an error. The dimension nn is automatically inferred from the input matrix and is equal to the number of columns.

Usage

checkClosedUnitBall(x)

Arguments

x

Matrix with numeric entries. Each row represents one point

Value

Vector where each element (TRUE or FALSE) indicates if a point is in the closed unit ball

Author(s)

Klaus Herrmann

Examples

x <- matrix(rnorm(30),10,3)
checkClosedUnitBall(x)

Domain check for closed unit hypercube [0,1]n[0,1]^n

Description

The function checks if a point (one row in the input argument) is inside the closed unit hypercube [0,1]n[0,1]^n or not. If the input matrix contains entries that are not numeric, i.e., not representing real numbers, the function throws an error. The dimension nn is automatically inferred from the input matrix and is equal to the number of columns.

Usage

checkClosedUnitCube(x)

Arguments

x

Matrix with numeric entries. Each row represents one point

Value

Vector where each element (TRUE or FALSE) indicates if a point is in the unit hypercube

Author(s)

Klaus Herrmann

Examples

x <- matrix(rnorm(30),10,3)
checkClosedUnitCube(x)

Domain check for [0,)n[0,\infty)^n

Description

The function checks if a point (one row in the input argument) is inside [0,)n=×i=1n[0,)[0,\infty)^n = \times_{i=1}^n [0,\infty) or not. In this case the return values are all TRUE. If the input matrix contains entries that are not numeric, i.e., not representing real numbers, the function throws an error. The dimension nn is automatically inferred from the input matrix and is equal to the number of columns.

Usage

checkPos(x)

Arguments

x

Matrix with numeric entries. Each row represents one point

Value

Vector where each element (TRUE or FALSE) indicates if a point is in [0,)n[0,\infty)^n

Author(s)

Klaus Herrmann

Examples

x <- matrix(rexp(30,rate=1),10,3)
checkPos(x)

Domain check for RnR^n

Description

The function checks if a point (one row in the input argument) is inside the n-dimensional Euclidean space Rn=×i=1nRR^n = \times_{i=1}^n R or not. In this case the return values are all TRUE. If the input matrix contains entries that are not numeric, i.e., not representing real numbers, the function throws an error. The dimension nn is automatically inferred from the input matrix and is equal to the number of columns.

Usage

checkRn(x)

Arguments

x

Matrix with numeric entries. Each row represents one point

Value

Vector where each element (TRUE or FALSE) indicates if a point is in R^n

Author(s)

Klaus Herrmann

Examples

x <- matrix(rnorm(30),10,3)
checkRn(x)

Domain check for standard simplex {xRn:xi0,x11}\{\vec{x} \in R^n : x_i \geq 0, \Vert \vec{x} \Vert_1 \leq 1 \}

Description

The function checks if a point (one row in the input argument) is inside the standard simplex {xRn:xi,x11}\{\vec{x} \in R^n : x_i \geq, \Vert \vec{x} \Vert_1 \leq 1 \} or not. If the input matrix contains entries that are not numeric, i.e., not representing real numbers, the function throws an error. The dimension nn is automatically inferred from the input matrix and is equal to the number of columns.

Usage

checkStandardSimplex(x)

Arguments

x

Matrix with numeric entries. Each row represents one point

Value

Vector where each element (TRUE or FALSE) indicates if a point is in the standard simplex

Author(s)

Klaus Herrmann

Examples

x <- matrix(rnorm(30),10,3)
checkStandardSimplex(x)

Domain check for unit sphere {xRn:x2=1}\{\vec{x} \in R^n : \Vert \vec{x} \Vert_{2} = 1\}

Description

The function checks if a point (one row in the input argument) is inside the unit sphere {xRn:x2=1}\{\vec{x} \in R^n : \Vert \vec{x} \Vert_2 = 1\} or not. If the input matrix contains entries that are not numeric, i.e., not representing real numbers, the function throws an error. The dimension nn is automatically inferred from the input matrix and is equal to the number of columns. The function allows for an additional parameter ε0\varepsilon\geq 0 to test {xRn:1εx21+ε}\{\vec{x} \in R^n : 1-\varepsilon \leq \Vert \vec{x} \Vert_2 \leq 1 + \varepsilon\}. WARNING: Due to floating point arithmetic the default value of ε=0\varepsilon=0 will not work properly in most cases.

Usage

checkUnitSphere(x, eps = 0)

Arguments

x

Matrix with numeric entries. Each row represents one point

eps

Non-negative numeric that allows to test points with an additional tolerance

Value

Vector where each element (TRUE or FALSE) indicates if a point is in the unit sphere

Author(s)

Klaus Herrmann

Examples

x <- matrix(rnorm(30),10,3)
checkUnitSphere(x,eps=0.001)

Check if node points are in the domain of a test function instance

Description

domainCheck is a generic function that allows to test if a collection of evaluation points are inside the integration domain associated to the test function instance or not.

Usage

domainCheck(object, x)

## S4 method for signature 'Pn_lognormalDensity,matrix'
domainCheck(object, x)

## S4 method for signature 'Pn_logtDensity,matrix'
domainCheck(object, x)

## S4 method for signature 'Rn_Gauss,matrix'
domainCheck(object, x)

## S4 method for signature 'Rn_floorNorm,matrix'
domainCheck(object, x)

## S4 method for signature 'Rn_normalDensity,matrix'
domainCheck(object, x)

## S4 method for signature 'Rn_tDensity,matrix'
domainCheck(object, x)

## S4 method for signature 'standardSimplex_Dirichlet,matrix'
domainCheck(object, x)

## S4 method for signature 'standardSimplex_exp_sum,matrix'
domainCheck(object, x)

## S4 method for signature 'unitBall_normGauss,matrix'
domainCheck(object, x)

## S4 method for signature 'unitBall_polynomial,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_BFN1,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_BFN2,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_BFN3,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_BFN4,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_Genz1,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_cos2,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_floor,matrix'
domainCheck(object, x)

## S4 method for signature 'unitCube_max,matrix'
domainCheck(object, x)

## S4 method for signature 'unitSphere_innerProduct1,matrix'
domainCheck(object, x)

## S4 method for signature 'unitSphere_polynomial,matrix'
domainCheck(object, x)

Arguments

object

Test function that gets evaluated

x

Matrix where each row represents one evaluation point

Value

Vector where each element (TRUE or FALSE) indicates if a point (row in the input matrix) is in the integration domain

Author(s)

Klaus Herrmann


Check if node points are in the domain of a test function instance ("overload" of domainCheck with additional parameter)

Description

domainCheckP is a generic function that allows to test if a collection of evaluation points are inside the integration domain associated to the test function instance or not. This "overload" of domainCheck allows to pass a list of additional parameters.

Usage

domainCheckP(object, x, param)

## S4 method for signature 'unitSphere_innerProduct1,matrix,list'
domainCheckP(object, x, param)

## S4 method for signature 'unitSphere_polynomial,matrix,list'
domainCheckP(object, x, param)

Arguments

object

Test function that gets evaluated

x

Matrix where each row represents one evaluation point

param

List of additional parameters

Value

Vector where each element (TRUE or FALSE) indicates if a point (row in the input matrix) is in the integration domain

Author(s)

Klaus Herrmann


Evaluate test function instance for a set of node points

Description

evaluate is a generic function that evaluates the test function instance for a collection of evaluation points represented by a matrix. Each row is one evaluation point.

Usage

evaluate(object, x)

## S4 method for signature 'Pn_lognormalDensity,matrix'
evaluate(object, x)

## S4 method for signature 'Pn_logtDensity,ANY'
evaluate(object, x)

## S4 method for signature 'Rn_Gauss,matrix'
evaluate(object, x)

## S4 method for signature 'Rn_floorNorm,matrix'
evaluate(object, x)

## S4 method for signature 'Rn_normalDensity,matrix'
evaluate(object, x)

## S4 method for signature 'Rn_tDensity,ANY'
evaluate(object, x)

## S4 method for signature 'standardSimplex_Dirichlet,matrix'
evaluate(object, x)

## S4 method for signature 'standardSimplex_exp_sum,matrix'
evaluate(object, x)

## S4 method for signature 'unitBall_normGauss,matrix'
evaluate(object, x)

## S4 method for signature 'unitBall_polynomial,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_BFN1,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_BFN2,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_BFN3,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_BFN4,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_Genz1,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_cos2,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_floor,matrix'
evaluate(object, x)

## S4 method for signature 'unitCube_max,matrix'
evaluate(object, x)

## S4 method for signature 'unitSphere_innerProduct1,matrix'
evaluate(object, x)

## S4 method for signature 'unitSphere_polynomial,matrix'
evaluate(object, x)

Arguments

object

Test function that gets evaluated

x

Matrix where each row represents one evaluation point

Value

Vector where each element is an evaluation of the test function for a node point (row in x)

Author(s)

Klaus Herrmann


Get exact integral for test function instance

Description

exactIntegral is a generic function that allows to calculate the exact value of a test function instance over the associated integration domain.

Usage

exactIntegral(object)

## S4 method for signature 'Pn_lognormalDensity'
exactIntegral(object)

## S4 method for signature 'Pn_logtDensity'
exactIntegral(object)

## S4 method for signature 'Rn_Gauss'
exactIntegral(object)

## S4 method for signature 'Rn_floorNorm'
exactIntegral(object)

## S4 method for signature 'Rn_normalDensity'
exactIntegral(object)

## S4 method for signature 'Rn_tDensity'
exactIntegral(object)

## S4 method for signature 'standardSimplex_Dirichlet'
exactIntegral(object)

## S4 method for signature 'standardSimplex_exp_sum'
exactIntegral(object)

## S4 method for signature 'unitBall_normGauss'
exactIntegral(object)

## S4 method for signature 'unitBall_polynomial'
exactIntegral(object)

## S4 method for signature 'unitCube_BFN1'
exactIntegral(object)

## S4 method for signature 'unitCube_BFN2'
exactIntegral(object)

## S4 method for signature 'unitCube_BFN3'
exactIntegral(object)

## S4 method for signature 'unitCube_BFN4'
exactIntegral(object)

## S4 method for signature 'unitCube_Genz1'
exactIntegral(object)

## S4 method for signature 'unitCube_cos2'
exactIntegral(object)

## S4 method for signature 'unitCube_floor'
exactIntegral(object)

## S4 method for signature 'unitCube_max'
exactIntegral(object)

## S4 method for signature 'unitSphere_innerProduct1'
exactIntegral(object)

## S4 method for signature 'unitSphere_polynomial'
exactIntegral(object)

Arguments

object

The test function that gets evaluated

Value

Numeric value of the integral of the test function

Author(s)

Klaus Herrmann


Get description of integration domain for test function instance

Description

getIntegrationDomain is a generic function that returns a description of the integration domain associate to the test function instance.

Usage

getIntegrationDomain(object)

## S4 method for signature 'Pn_lognormalDensity'
getIntegrationDomain(object)

## S4 method for signature 'Pn_logtDensity'
getIntegrationDomain(object)

## S4 method for signature 'Rn_Gauss'
getIntegrationDomain(object)

## S4 method for signature 'Rn_floorNorm'
getIntegrationDomain(object)

## S4 method for signature 'Rn_normalDensity'
getIntegrationDomain(object)

## S4 method for signature 'Rn_tDensity'
getIntegrationDomain(object)

## S4 method for signature 'standardSimplex_Dirichlet'
getIntegrationDomain(object)

## S4 method for signature 'standardSimplex_exp_sum'
getIntegrationDomain(object)

## S4 method for signature 'unitBall_normGauss'
getIntegrationDomain(object)

## S4 method for signature 'unitBall_polynomial'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_BFN1'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_BFN2'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_BFN3'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_BFN4'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_Genz1'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_cos2'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_floor'
getIntegrationDomain(object)

## S4 method for signature 'unitCube_max'
getIntegrationDomain(object)

## S4 method for signature 'unitSphere_innerProduct1'
getIntegrationDomain(object)

## S4 method for signature 'unitSphere_polynomial'
getIntegrationDomain(object)

Arguments

object

Test function for which the description is returned

Value

Description of the integration domain of the function

Author(s)

Klaus Herrmann


Get references for test function instance

Description

getReferences is a generic function that returns a vector of references associated to the test function instance.

Usage

getReferences(object)

## S4 method for signature 'Pn_lognormalDensity'
getReferences(object)

## S4 method for signature 'Pn_logtDensity'
getReferences(object)

## S4 method for signature 'Rn_Gauss'
getReferences(object)

## S4 method for signature 'Rn_floorNorm'
getReferences(object)

## S4 method for signature 'Rn_normalDensity'
getReferences(object)

## S4 method for signature 'Rn_tDensity'
getReferences(object)

## S4 method for signature 'standardSimplex_Dirichlet'
getReferences(object)

## S4 method for signature 'standardSimplex_exp_sum'
getReferences(object)

## S4 method for signature 'unitBall_normGauss'
getReferences(object)

## S4 method for signature 'unitBall_polynomial'
getReferences(object)

## S4 method for signature 'unitCube_BFN1'
getReferences(object)

## S4 method for signature 'unitCube_BFN2'
getReferences(object)

## S4 method for signature 'unitCube_BFN3'
getReferences(object)

## S4 method for signature 'unitCube_BFN4'
getReferences(object)

## S4 method for signature 'unitCube_Genz1'
getReferences(object)

## S4 method for signature 'unitCube_cos2'
getReferences(object)

## S4 method for signature 'unitCube_floor'
getReferences(object)

## S4 method for signature 'unitCube_max'
getReferences(object)

## S4 method for signature 'unitSphere_innerProduct1'
getReferences(object)

## S4 method for signature 'unitSphere_polynomial'
getReferences(object)

Arguments

object

Test function for which the references are returned

Value

Vector with references for the specific function

Author(s)

Klaus Herrmann


Get tags for test function instance

Description

getTags is a generic function that returns a vector of tags associated to the test function instance.

Usage

getTags(object)

## S4 method for signature 'Pn_lognormalDensity'
getTags(object)

## S4 method for signature 'Pn_logtDensity'
getTags(object)

## S4 method for signature 'Rn_Gauss'
getTags(object)

## S4 method for signature 'Rn_floorNorm'
getTags(object)

## S4 method for signature 'Rn_normalDensity'
getTags(object)

## S4 method for signature 'Rn_tDensity'
getTags(object)

## S4 method for signature 'standardSimplex_Dirichlet'
getTags(object)

## S4 method for signature 'standardSimplex_exp_sum'
getTags(object)

## S4 method for signature 'unitBall_normGauss'
getTags(object)

## S4 method for signature 'unitBall_polynomial'
getTags(object)

## S4 method for signature 'unitCube_BFN1'
getTags(object)

## S4 method for signature 'unitCube_BFN2'
getTags(object)

## S4 method for signature 'unitCube_BFN3'
getTags(object)

## S4 method for signature 'unitCube_BFN4'
getTags(object)

## S4 method for signature 'unitCube_Genz1'
getTags(object)

## S4 method for signature 'unitCube_cos2'
getTags(object)

## S4 method for signature 'unitCube_floor'
getTags(object)

## S4 method for signature 'unitCube_max'
getTags(object)

## S4 method for signature 'unitSphere_innerProduct1'
getTags(object)

## S4 method for signature 'unitSphere_polynomial'
getTags(object)

Arguments

object

Test function for which the tags are returned

Value

Vector with tags related to the function

Author(s)

Klaus Herrmann


multIntTestFunc: A package to define test functions for multivariate numerical integration.

Description

The multIntTestFunc package provides multivariate test functions to test numerical integration routines. The functions are available in all dimensions n>=1 and the exact value of the integral is known.

multIntTestFunc functions

The multIntTestFunc functions are S4 classes that are instantiated with the dimension and additional parameters if necessary. They implement methods to evaluate the function for given evaluation points (arranged in a matrix) and to evaluate the exact value of the integral of the function over the respective integration domain.


Product rule for numerical quadrature from univariate nodes and weights

Description

The function allows to build a multivariate quadrature rule from univariate ones. The multivariate node points are all possible combinations of the univariate node points, and the final weights are the product of the respective univariate weights.

Usage

pIntRule(x, dim = NULL)

Arguments

x

Either a list with two elements $nodes and $weights representing a one dimensional quadrature formula which are then used for all dimensions, or a list where each element is a itself a list with two elements $nodes and $weights. In this case the respective quadrature rule is used for each dimension.

dim

An integer that defines the dimension of the output quadrature formula. Default is NULL. If dim is NULL then x has to be a list of quadrature rules (list of lists) and the dimensions is automatically generated. If dim is a positive integer value the same quadrature rule is used in all dimensions.

Value

A list with a matrix of multivariate node points (each row is one point) and a vector of corresponding weights

Author(s)

Klaus Herrmann

Examples

require(statmod)
herm <- gauss.quad(2,"hermite")
lag <- gauss.quad(3,"laguerre")
qRule1 <- pIntRule(herm,2)
qRule2 <- pIntRule(list(herm,lag))

An S4 class to represent the function 1(i=1nxi)(2π)ndet(Σ)exp(((ln(x)μ)TΣ1(ln(x)μ))/2)\frac{1}{(\prod_{i=1}^{n}x_i) \sqrt{(2\pi)^n\det(\Sigma)}}\exp(-((\ln(\vec{x})-\vec{\mu})^{T}\Sigma^{-1}(\ln(\vec{x})-\vec{\mu}))/2) on [0,)n[0,\infty)^n

Description

Implementation of the function

f ⁣:Rn[0,),xf(x)=1(i=1nxi)(2π)ndet(Σ)exp(((ln(x)μ)TΣ1(ln(x)μ))/2),f \colon R^n \to [0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \frac{1}{(\prod_{i=1}^{n}x_i) \sqrt{(2\pi)^n\det(\Sigma)}}\exp(-((\ln(\vec{x})-\vec{\mu})^{T}\Sigma^{-1}(\ln(\vec{x})-\vec{\mu}))/2),

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain [0,)n=×i=1n[0,)[0,\infty)^n = \times_{i=1}^n [0,\infty). In this case the integral is know to be

Rnf(x)dx=1.\int_{R^n} f(\vec{x}) d\vec{x} = 1.

Details

The instance needs to be created with three parameters representing the dimension nn, the location vector μ\vec{\mu} and the variance-covariance matrix Σ\Sigma which needs to be symmetric positive definite.

Slots

dim

An integer that captures the dimension

mean

A vector of size dim with real entries.

sigma

A matrix of size dim x dim that is symmetric positive definite.

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("Pn_lognormalDensity",dim=n,mean=rep(0,n),sigma=diag(n))

An S4 class to represent the function (i=1nxi1)Γ[(ν+n)/2]Γ(ν/2)νn/2πn/2Σ1/2[1+1ν(log(x)δ)TΣ1(log(x)δ)](ν+n)/2(\prod_{i=1}^n x_i^{-1})\frac{\Gamma\left[(\nu+n)/2\right]}{\Gamma(\nu/2)\nu^{n/2}\pi^{n/2}\left|{\Sigma}\right|^{1/2}}\left[1+\frac{1}{\nu}({\log(\vec{x})}-{\vec{\delta}})^{T}{\Sigma}^{-1}({\log(\vec{x})}-{\vec{\delta}})\right]^{-(\nu+n)/2} on [0,)n[0,\infty)^n

Description

Implementation of the function

f ⁣:[0,)n(0,),xf(x)=(i=1nxi1)Γ[(ν+n)/2]Γ(ν/2)νn/2πn/2Σ1/2[1+1ν(log(x)δ)TΣ1(log(x)δ)](ν+n)/2,f \colon [0,\infty)^n \to (0,\infty),\, \vec{x} \mapsto f(\vec{x}) = (\prod_{i=1}^n x_i^{-1})\frac{\Gamma\left[(\nu+n)/2\right]}{\Gamma(\nu/2)\nu^{n/2}\pi^{n/2}\left|{\Sigma}\right|^{1/2}}\left[1+\frac{1}{\nu}({\log(\vec{x})}-{\vec{\delta}})^{T}{\Sigma}^{-1}({\log(\vec{x})}-{\vec{\delta}})\right]^{-(\nu+n)/2},

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain [0,)n=×i=1n[0,)[0,\infty)^n = \times_{i=1}^n [0,\infty). In this case the integral is know to be

[0,)nf(x)dx=1.\int_{[0,\infty)^n} f(\vec{x}) d\vec{x} = 1.

Details

The instance needs to be created with four parameters representing the dimension nn, the location vector δ\vec{\delta}, the variance-covariance matrix Σ\Sigma which needs to be symmetric positive definite and the degrees of freedom parameter ν\nu.

Slots

dim

An integer that captures the dimension

delta

A vector of size dim with real entries.

sigma

A matrix of size dim x dim that is symmetric positive definite.

df

A positive numerical value representing the degrees of freedom.

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("Pn_logtDensity",dim=n,delta=rep(0,n),sigma=diag(n),df=3)

An S4 class to represent the function Γ(n/2+1)πn/2(1+x2n)s\frac{\Gamma(n/2+1)}{\pi^{n/2}(1+\lfloor \Vert \vec{x} \Vert_2^n \rfloor)^s} on RnR^n

Description

Implementation of the function

f ⁣:Rn[0,),xf(x)=Γ(n/2+1)πn/2(1+x2n)s,f \colon R^n \to [0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \frac{\Gamma(n/2+1)}{\pi^{n/2}(1+\lfloor \Vert \vec{x} \Vert_2^n \rfloor)^s},

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Rn=×i=1nRR^n = \times_{i=1}^n R and s>1s>1 is a parameter. In this case the integral is know to be

Rnf(x)dx=ζ(s),\int_{R^n} f(\vec{x}) d\vec{x} = \zeta(s),

where ζ(s)\zeta(s) is the Riemann zeta function.

Details

The instance needs to be created with two parameters representing nn and ss.

Slots

dim

An integer that captures the dimension

s

A numeric value bigger than 1 representing a power

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("Rn_floorNorm",dim=n,s=2)

An S4 class to represent the function exp(xx)\exp(-\vec{x}\cdot\vec{x}) on RnR^n

Description

Implementation of the function

f ⁣:Rn(0,),xf(x)=exp(xx)=exp(i=1nxi2),f \colon R^n \to (0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \exp(-\vec{x}\cdot\vec{x}) = \exp(-\sum_{i=1}^n x_i^2),

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Rn=×i=1nRR^n = \times_{i=1}^n R. In this case the integral is know to be

Rnf(x)dx=πn/2.\int_{R^n} f(\vec{x}) d\vec{x} = \pi^{n/2}.

Details

The instance needs to be created with one parameter representing nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("Rn_Gauss",dim=n)

An S4 class to represent the function 1(2π)ndet(Σ)exp(((xμ)TΣ1(xμ))/2)\frac{1}{\sqrt{(2\pi)^n\det(\Sigma)}}\exp(-((\vec{x}-\vec{\mu})^{T}\Sigma^{-1}(\vec{x}-\vec{\mu}))/2) on RnR^n

Description

Implementation of the function

f ⁣:Rn(0,),xf(x)=1(2π)ndet(Σ)exp(((xμ)TΣ1(xμ))/2),f \colon R^n \to (0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \frac{1}{\sqrt{(2\pi)^n\det(\Sigma)}}\exp(-((\vec{x}-\vec{\mu})^{T}\Sigma^{-1}(\vec{x}-\vec{\mu}))/2),

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Rn=×i=1nRR^n = \times_{i=1}^n R. In this case the integral is know to be

Rnf(x)dx=1.\int_{R^n} f(\vec{x}) d\vec{x} = 1.

Details

The instance needs to be created with three parameters representing the dimension nn, the location vector μ\vec{\mu} and the variance-covariance matrix Σ\Sigma which needs to be symmetric positive definite.

Slots

dim

An integer that captures the dimension

mean

A vector of size dim with real entries.

sigma

A matrix of size dim x dim that is symmetric positive definite.

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("Rn_normalDensity",dim=n,mean=rep(0,n),sigma=diag(n))

An S4 class to represent the function Γ[(ν+n)/2]Γ(ν/2)νn/2πn/2Σ1/2[1+1ν(xδ)TΣ1(xδ)](ν+n)/2\frac{\Gamma\left[(\nu+n)/2\right]}{\Gamma(\nu/2)\nu^{n/2}\pi^{n/2}\left|{\Sigma}\right|^{1/2}}\left[1+\frac{1}{\nu}({\vec{x}}-{\vec{\delta}})^{T}{\Sigma}^{-1}({\vec{x}}-{\vec{\delta}})\right]^{-(\nu+n)/2} on RnR^n

Description

Implementation of the function

f ⁣:Rn(0,),xf(x)=Γ[(ν+n)/2]Γ(ν/2)νn/2πn/2Σ1/2[1+1ν(xδ)TΣ1(xδ)](ν+n)/2,f \colon R^n \to (0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \frac{\Gamma\left[(\nu+n)/2\right]}{\Gamma(\nu/2)\nu^{n/2}\pi^{n/2}\left|{\Sigma}\right|^{1/2}}\left[1+\frac{1}{\nu}({\vec{x}}-{\vec{\delta}})^{T}{\Sigma}^{-1}({\vec{x}}-{\vec{\delta}})\right]^{-(\nu+n)/2},

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Rn=×i=1nRR^n = \times_{i=1}^n R. In this case the integral is know to be

Rnf(x)dx=1.\int_{R^n} f(\vec{x}) d\vec{x} = 1.

Details

The instance needs to be created with four parameters representing the dimension nn, the location vector δ\vec{\delta}, the variance-covariance matrix Σ\Sigma which needs to be symmetric positive definite and the degrees of freedom parameter ν\nu.

Slots

dim

An integer that captures the dimension

delta

A vector of size dim with real entries.

sigma

A matrix of size dim x dim that is symmetric positive definite.

df

A positive numerical value representing the degrees of freedom.

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("Rn_tDensity",dim=n,delta=rep(0,n),sigma=diag(n),df=3)

An S4 class to represent the function i=1nxivi1(1x1xn)vn+11\prod_{i=1}^{n}x_i^{v_i-1}(1 - x_1 - \ldots - x_n)^{v_{n+1}-1} on TnT_n

Description

Implementation of the function

f ⁣:Tn(0,),xf(x)=i=1nxivi1(1x1xn)vn+11,f \colon T_n \to (0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \prod_{i=1}^{n}x_i^{v_i-1}(1 - x_1 - \ldots - x_n)^{v_{n+1}-1},

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Tn={xRn:xi0,x11}T_n = \{\vec{x} \in \R^n : x_i\geq 0, \Vert \vec{x} \Vert_1 \leq 1\} and vi>0v_i>0, i=1,,n+1i=1,\ldots,n+1, are constants. The integral is known to be

Tnf(x)dx=i=1n+1Γ(vi)Γ(i=1n+1vi),\int_{T_n} f(\vec{x}) d\vec{x} = \frac{\prod_{i=1}^{n+1}\Gamma(v_i)}{\Gamma(\sum_{i=1}^{n+1}v_i)},

where vi>0v_i>0 for i=1,,n+1i=1,\ldots,n+1.

Details

The instance needs to be created with two parameters representing the dimension nn and the vector of positive parameters.

Slots

dim

An integer that captures the dimension

v

A vector of dimension n+1n+1 with positive entries representing the constants

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("standardSimplex_Dirichlet",dim=n,v=c(1,2,3,4))

An S4 class to represent the function exp(c(x1++xn))\exp(-c(x_1 + \ldots + x_n)) on TnT_n

Description

Implementation of the function

f ⁣:Tn(0,),xf(x)=exp(c(x1++xn)),f \colon T_n \to (0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \exp(-c(x_1 + \ldots + x_n)),

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Tn={xRn:xi0,x11}T_n = \{\vec{x} \in \R^n : x_i\geq 0, \Vert \vec{x} \Vert_1 \leq 1\} and c>0c>0 is a constant. The integral is known to be

Tnf(x)dx=Γ(n)Γ(n,c)Γ(n)cn,\int_{T_n} f(\vec{x}) d\vec{x} = \frac{\Gamma(n)-\Gamma(n,c)}{\Gamma(n)c^n},

where Γ(s,x)\Gamma(s,x) is the incomplete gamma function.

Details

The instance needs to be created with two parameters representing the dimension nn and the parameter c>0c>0.

Slots

dim

An integer that captures the dimension

coeff

A strictly positive number representing the constant

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("standardSimplex_exp_sum",dim=n,coeff=1)

An S4 class to represent the function 1(2π)n/2exp(x22/2)\frac{1}{(2\pi)^{n/2}}\exp(-\Vert\vec{x}\Vert_2^2/2) on BnB^{n}

Description

Implementation of the function

f ⁣:Bn[0,),xf(x)=1(2π)n/2exp(x22/2)=1(2π)n/2exp(12i=1nxi2),f \colon B_n \to [0,\infty),\, \vec{x} \mapsto f(\vec{x}) = \frac{1}{(2\pi)^{n/2}}\exp(-\Vert\vec{x}\Vert_2^2/2) = \frac{1}{(2\pi)^{n/2}}\exp(-\frac{1}{2}\sum_{i=1}^n x_i^2),

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Bn={xRn:x21}B_n = \{\vec{x}\in R^n : \Vert \vec{x} \Vert_2 \leq 1\}. In this case the integral is know to be

Bnf(x)dx=P[Z1]=Fχn2(1),\int_{B_n} f(\vec{x}) d\vec{x} = P[Z \leq 1] = F_{\chi^2_n}(1),

where ZZ follows a chisquare distribution with nn degrees of freedom.

Details

The instance needs to be created with one parameter representing nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitBall_normGauss",dim=n)

An S4 class to represent the function i=1nxiai\prod_{i=1}^n x_i^{a_i} on BnB_n

Description

Implementation of the function

f ⁣:BnR,xf(x)=i=1nxiai,f \colon B_n \to R,\, \vec{x} \mapsto f(\vec{x}) = \prod_{i=1}^n x_i^{a_i},

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Bn={xRn:x21}B_n = \{\vec{x}\in R^n : \Vert \vec{x} \Vert_2 \leq 1\} and ai{0,1,2,3,}a_i \in \{0,1,2,3,\ldots\}, i=1,,ni=1,\ldots,n, are parameters. If at least one of the coefficients aia_i is odd, i.e., ai{1,3,5,7,}a_i\in\{1,3,5,7,\ldots\} for at leas one i=1,,ni=1,\ldots,n, the integral is zero, otherwise the integral is known to be

Bnf(x)dx=2i=1nΓ(bi)Γ(i=1nbi)(n+i=1nai),\int_{B_n} f(\vec{x}) d\vec{x} = 2\frac{\prod_{i=1}^n\Gamma(b_i)}{\Gamma(\sum_{i=1}^n b_i)(n+\sum_{i=1}^n a_i)},

where bi=(ai+1)/2b_i = (a_i+1)/2.

Details

The instance needs to be created with two parameters representing the dimension nn and a nn-dimensional vector of integers (including 00) representing the exponents.

Slots

dim

An integer that captures the dimension

expo

An vector that captures the exponents

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitBall_polynomial",dim=n,expo=c(1,2,3))

An S4 class to represent the function i=1n4xi2\prod^{n}_{i=1}\vert 4x_i-2\vert on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n(,),xf(x)=i=1n4xi2f \colon [0,1]^n \to (-\infty,\infty),\, \vec{x} \mapsto f(\vec{x}) = \prod^{n}_{i=1}\vert 4x_i-2\vert

, where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n. The integral is known to be

Cnf(x)dx=1.\int_{C_n} f(\vec{x}) d\vec{x} = 1.

Details

The instance needs to be created with one parameter representing the dimension nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitCube_BFN1",dim=n)

An S4 class to represent the function i=1nicos(ixi)\prod^{n}_{i=1} i\cos(ix_i) on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n(,),xf(x)=i=1nicos(ixi)f \colon [0,1]^n \to (-\infty,\infty),\, \vec{x} \mapsto f(\vec{x}) = \prod^{n}_{i=1} i\cos(ix_i)

, where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n. The integral is known to be

Cnf(x)dx=i=1nsin(i).\int_{C_n} f(\vec{x}) d\vec{x} = \prod^{n}_{i=1}\sin(i).

Details

The instance needs to be created with one parameter representing the dimension nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitCube_BFN2",dim=n)

An S4 class to represent the function i=1nTν(i)(2xi1)\prod^{n}_{i=1} T_{\nu(i)}(2x_i-1) on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n(,),xf(x)=i=1nTν(i)(2xi1)f \colon [0,1]^n \to (-\infty,\infty),\, \vec{x} \mapsto f(\vec{x}) = \prod^{n}_{i=1} T_{\nu(i)}(2x_i-1)

, where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n and TkT_k is the Chebyshev polynomial of degree kk and ν(i)=(imod4)+1\nu(i) = (i \mod 4) + 1. The integral is known to be

Cnf(x)dx=0.\int_{C_n} f(\vec{x}) d\vec{x} = 0.

Details

The instance needs to be created with one parameter representing the dimension nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitCube_BFN3",dim=n)

An S4 class to represent the function i=1n(1)ij=1ixj\sum_{i=1}^{n}(-1)^i \prod_{j=1}^{i} x_j on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n(,),xf(x)=i=1n(1)ij=1ixjf \colon [0,1]^n \to (-\infty,\infty),\, \vec{x} \mapsto f(\vec{x}) = \sum_{i=1}^{n}(-1)^i \prod_{j=1}^{i} x_j

, where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n. The integral is known to be

Cnf(x)dx=(1(1/2)n)/3.\int_{C_n} f(\vec{x}) d\vec{x} = -(1-(-1/2)^n)/3.

Details

The instance needs to be created with one parameter representing the dimension nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitCube_BFN4",dim=n)

An S4 class to represent the function (cos(xv))2(\cos(\vec{x}\cdot\vec{v}))^2 on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n[0,1],xf(x)=(cos(xv))2,f \colon [0,1]^n \to [0,1],\, \vec{x} \mapsto f(\vec{x}) = (\cos(\vec{x}\cdot\vec{v}))^2,

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n and v\vec{v} is a nn-dimensional parameter vector where each entry is different from 00. The integral is known to be

Cnf(x)dx=12+12cos(j=1nvj)j=1nsin(vj)vj.\int_{C_n} f(\vec{x}) d\vec{x} = \frac{1}{2}+\frac{1}{2}\cos(\sum_{j=1}^{n}v_j)\prod_{j=1}^{n}\frac{\sin(v_j)}{v_j}.

Details

The instance needs to be created with two parameters representing the dimension nn and the nn-dimensional parameter vector where each entry is different from 00.

Slots

dim

An integer that captures the dimension

coeffs

A vector of non-zero parameters

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitCube_cos2",dim=n, coeffs=c(-1,2,-2))

An S4 class to represent the function x1++xn\lfloor x_1 + \ldots + x_n \rfloor on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n[0,n],xf(x)=x1++xn,f \colon [0,1]^n \to [0,n],\, \vec{x} \mapsto f(\vec{x}) = \lfloor x_1 + \ldots + x_n \rfloor,

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n. The integral is known to be

Cnf(x)dx=n12.\int_{C_n} f(\vec{x}) d\vec{x} = \frac{n-1}{2}.

Details

The instance needs to be created with one parameter representing the dimension nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitCube_floor",dim=n)

An S4 class to represent the function cos(2πu+i=1naixi)\cos\left(2\pi u + \sum^{n}_{i=1} a_i x_i \right) on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n(,),xf(x)=cos(2πu+i=1naixi)f \colon [0,1]^n \to (-\infty,\infty),\, \vec{x} \mapsto f(\vec{x}) = \cos\left(2\pi u + \sum^{n}_{i=1} a_i x_i \right)

, where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n. The integral is known to be

Cnf(x)dx=2ncos(2πu+i=1nai/2)i=1nsin(ai/2)i=1nai.\int_{C_n} f(\vec{x}) d\vec{x} = \frac{2^n \cos\left(2\pi u + \sum_{i=1}^{n}a_i/2\right) \prod_{i=1}^n \sin(a_i/2)}{\prod_{i=1}^n a_i}.

Details

The instance needs to be created with three parameter representing the dimension nn, the real number uu and the vector (a1,...,an)(a_1,...,a_n).

Slots

dim

An integer that captures the dimension

u

A real number representing a shift in the integrand

a

A vector of real numbers, each non-zero, increasing the difficulty of the integrand with higher absolute values

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
u <- pi
a <- rep(exp(1),n)
f <- new("unitCube_Genz1",dim=n, u=u, a=a)

An S4 class to represent the function max(x1,,xn)\max(x_1,\ldots,x_n) on [0,1]n[0,1]^n

Description

Implementation of the function

f ⁣:[0,1]n[0,n],xf(x)=max(x1,,xn)f \colon [0,1]^n \to [0,n],\, \vec{x} \mapsto f(\vec{x}) = \max(x_1,\ldots,x_n)

, where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Cn=[0,1]nC_n = [0,1]^n. The integral is known to be

Cnf(x)dx=nn+1.\int_{C_n} f(\vec{x}) d\vec{x} = \frac{n}{n+1}.

Details

The instance needs to be created with one parameter representing the dimension nn.

Slots

dim

An integer that captures the dimension

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitCube_max",dim=n)

An S4 class to represent the function (xa)(xb)(\vec{x}\cdot\vec{a})(\vec{x}\cdot\vec{b}) on Sn1S^{n-1}

Description

Implementation of the function

f ⁣:Sn1R,xf(x)=(xa)(xb),f \colon S^{n-1} \to R,\, \vec{x} \mapsto f(\vec{x}) = (\vec{x}\cdot\vec{a})(\vec{x}\cdot\vec{b}),

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Sn1={xRn:x2=1}S^{n-1} = \{\vec{x}\in R^n : \Vert \vec{x} \Vert_2 = 1\} and a\vec{a} and b\vec{b} are two nn-dimensional parameter vectors. The integral is known to be

Sn1f(x)dx=2πn/2(ab)nΓ(n/2),\int_{S^{n-1}} f(\vec{x}) d\vec{x} = \frac{2\pi^{n/2}(\vec{a}\cdot\vec{b})}{n\Gamma(n/2)},

where aRn\vec{a}\in R^n and bRn\vec{b}\in R^n.

Details

Due to the difficulty of testing x2=1\Vert \vec{x} \Vert_2 = 1 in floating point arithmetic this class also implements the function "domainCheckP". This allows to pass a list with an additional non-negative parameter "eps" representing a non-negative real number ε\varepsilon and allows to test 1εx21+ε1-\varepsilon \leq \Vert \vec{x} \Vert_2 \leq 1+\varepsilon. See also the documentation of the function "checkUnitSphere" that is used to perform the checks.

The instance needs to be created with three parameters representing the dimension nn and the two nn-dimensional (real) vectors a\vec{a} and b\vec{b}.

Slots

dim

An integer that captures the dimension

a

A nn-dimensional real vector

b

A nn-dimensional real vector

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitSphere_innerProduct1",dim=n,a=c(1,2,3),b=c(-1,-2,-3))

An S4 class to represent the function i=1nxiai\prod_{i=1}^n x_i^{a_i} on Sn1S^{n-1}

Description

Implementation of the function

f ⁣:Sn1R,xf(x)=i=1nxiai,f \colon S^{n-1} \to R,\, \vec{x} \mapsto f(\vec{x}) = \prod_{i=1}^n x_i^{a_i},

where n{1,2,3,}n \in \{1,2,3,\ldots\} is the dimension of the integration domain Sn1={xRn:x2=1}S^{n-1} = \{\vec{x}\in R^n : \Vert \vec{x} \Vert_2 = 1\} and ai{0,1,2,3,}a_i \in \{0,1,2,3,\ldots\}, i=1,,ni=1,\ldots,n, are parameters. If at least one of the coefficients aia_i is odd, i.e., ai{1,3,5,7,}a_i\in\{1,3,5,7,\ldots\} for at leas one i=1,,ni=1,\ldots,n, the integral is zero, otherwise the integral is known to be

Sn1f(x)dx=2i=1nΓ(bi)Γ(i=1nbi),\int_{S^{n-1}} f(\vec{x}) d\vec{x} = 2\frac{\prod_{i=1}^n\Gamma(b_i)}{\Gamma(\sum_{i=1}^n b_i)},

where bi=(ai+1)/2b_i = (a_i+1)/2.

Details

Due to the difficulty of testing x2=1\Vert \vec{x} \Vert_2 = 1 in floating point arithmetic this class also implements the function "domainCheckP". This allows to pass a list with an additional non-negative parameter "eps" representing a non-negative real number ε\varepsilon and allows to test 1εx21+ε1-\varepsilon \leq \Vert \vec{x} \Vert_2 \leq 1+\varepsilon. See also the documentation of the function "checkUnitSphere" that is used to perform the checks.

The instance needs to be created with two parameters representing the dimension nn and a nn-dimensional vector of integers (including 00) representing the exponents.

Slots

dim

An integer that captures the dimension

expo

An vector that captures the exponents

Author(s)

Klaus Herrmann

Examples

n <- as.integer(3)
f <- new("unitSphere_polynomial",dim=n,expo=c(1,2,3))