Approximate the integral over the sphere or ball in n-dimensions using polar coordinates. Can also integrate over sectors of the sphere/ball, see details. These functions will be slow, but may be necessary to get accurate answers if the integrand function f(x) is not smooth. If the integrand changes rapidly in certain regions, the basic routines adaptIntegrateSpherePolar and codeadaptIntegrateBallPolar will likely miss these abrupt changes and give inaccurate results. For cases where the location of the rapid changes are known, the functions adaptIntegrateSpherePolarSplit and codeadaptIntegrateBallPolarSplit allow you to split the region of integration and capture those changes.
Convert between polar and rectangular coordinates in n-dimensions. The point (x[1],...,x[n]) in rectangular coordinates corresponds to the point (r,phi[1],...,phi[n-1]) in polar coordinates.
Adaptively integrate a function over a set of spherical triangles. adaptIntegrateSphereTri3d works only in 3-dimensions and is described in the paper by N. Boal and F-J. Sayas at: www.unizar.es/galdeano/actas_pau/PDFVIII/pp61-69.pdf. This method is not sophisticated, but can be useful and is self contained. Function adaptIntegrateSphereTri uses hyperspherical triangles and works in n-dimensions.