powered by
Convenience function for Monte Carlo integration on \([-\pi, \pi)^p\).
mcTorusIntegrate(f, p, M = 1e+05, fVect = TRUE, ...)
A scalar with the approximated integral.
function to be integrated.
dimension of the torus.
number of Monte Carlo replicates.
is f vectorized?
f
further parameters passed to f.
# Integral of sin(x1) * cos(x2), must be close to 0 mcTorusIntegrate(f = function(x) sin(x[, 1]) * cos(x[, 2]), p = 2)
Run the code above in your browser using DataLab