int {DirStats} | R Documentation |
Integration routines
Description
Several quadrature rules for integration of functions on
S^1
, S^2
, and S^q
, q \ge 3
.
Usage
int_cir(f, N = 500, na.rm = TRUE, f_vect = TRUE, ...)
int_sph(f, na.rm = TRUE, f_vect = TRUE, ...)
int_hypsph(f, q, M = 1e+05, na.rm = TRUE, f_vect = TRUE, ...)
Arguments
f |
function to be integrated on |
N |
Defaults to |
na.rm |
ignore possible |
f_vect |
can |
... |
further arguments passed to |
q |
dimension of |
M |
number of Monte Carlo replicates. Defaults to |
Details
int_cir
is an extension of equation (4.1.11) in Press et al. (1997),
a periodic trapezoidal rule. int_sph
employs the
Lebedev quadrature on S^2
. int_hypsph
implements a Monte Carlo integration on S^q
.
Value
A scalar approximating the integral.
References
Lebedev, V. I. and Laikov, D. N. (1999). A quadrature formula for the sphere of the 131st algebraic order of accuracy. Doklady Mathematics, 59(3):477–481.
Press, W. H., Teukolsky, S. A., Vetterling, W. T. and Flannery B. P. (1997). Numerical Recipes in Fortran 77: The Art of Scientific Computing. Volume 1. Cambridge University Press, Cambridge. Second edition.
Examples
# S^1, trapezoidal rule
f <- function(x) rotasym::d_vMF(x = x, mu = c(0, 1), kappa = 2)
int_cir(f = f)
# S^2, Lebedev rule
f <- function(x) rotasym::d_vMF(x = x, mu = c(0, 0, 1), kappa = 2)
int_sph(f = f)
# S^2, Monte Carlo
f <- function(x) rotasym::d_vMF(x = x, mu = c(0, 0, 1), kappa = 2)
int_hypsph(f = f, q = 2)