Integrate a function over the sphere in n-dimensions.
Approximate the integral of a function f(x)=f(x[1],...,x[n]) over the unit sphere in n-space using Stroud's method of degree 11.
integrateSphereStroud11(f, n, ...)
f
: function f(x)=f(x[1],...,x[n]) to integraten
: dimension of the space, implemented for n in the range 3:16....
: optional arguments passed to f( ). If these are specified, they should be labeled with a tag, e.g. param1=3.4This method works if the integrand is smooth. If the function changes rapidly, adaptive integration can be tried as described in 'See Also' below.
A single number, the approximation to the integral.
Stroud integration and related functions, adapted from fortran code by John Burkhart found at
http://people.sc.fsu.edu/~jburkardt/f77_src/stroud/stroud.html
Based on the book by A. H. Stroud, Approximate Calculation of multiple integrals, 1971, page 296-297.
adaptIntegrateSpherePolar
, adaptIntegrateBallPolar
, adaptIntegrateSphereTri
f2 <- function( x ) { return(x[1]^2) } integrateSphereStroud11( f2, n=3 )
Useful links