mcTorusIntegrate: Monte Carlo integration on the torus

View source: R/auxiliary.R

mcTorusIntegrateR Documentation

Monte Carlo integration on the torus

Description

Convenience function for Monte Carlo integration on [-\pi, \pi)^p.

Usage

mcTorusIntegrate(f, p, M = 1e+05, fVect = TRUE, ...)

Arguments

f

function to be integrated.

p

dimension of the torus.

M

number of Monte Carlo replicates.

fVect

is f vectorized?

...

further parameters passed to f.

Value

A scalar with the approximated integral.

Examples

# Integral of sin(x1) * cos(x2), must be close to 0
mcTorusIntegrate(f = function(x) sin(x[, 1]) * cos(x[, 2]), p = 2)

sdetorus documentation built on Aug. 21, 2023, 1:08 a.m.