The R package polyCub implements cubature (numerical integration) over polygonal domains. It solves the problem of integrating a continuously differentiable function \(f(x,y)\) over simple closed polygons.
Sebastian Meyer
polyCub provides the following cubature methods:
polyCub.SV
:General-purpose product Gauss cubature (Sommariva and Vianello, 2007)
polyCub.midpoint
:Simple two-dimensional midpoint rule based on
as.im.function
from spatstat.geom
(Baddeley et al., 2015)
polyCub.iso
:Adaptive cubature for radially symmetric functions
via line integrate()
along the polygon boundary
(Meyer and Held, 2014, Supplement B, Section 2.4).
A brief description and benchmark experiment of the above cubature
methods can be found in the vignette("polyCub")
.
There is also polyCub.exact.Gauss
, intended to
accurately (but slowly) integrate the bivariate Gaussian density;
however, this implementation is disabled as of polyCub 0.9.0:
it needs a reliable implementation of polygon triangulation.
Meyer (2010, Section 3.2) discusses and compares some of these methods.
Baddeley, A., Rubak, E. and Turner, R. (2015). Spatial Point Patterns: Methodology and Applications with R. Chapman and Hall/CRC Press, London.
Meyer, S. (2010). Spatio-Temporal Infectious Disease Epidemiology based on Point Processes. Master's Thesis, LMU Munich. Available as https://epub.ub.uni-muenchen.de/11703/.
Meyer, S. and Held, L. (2014). Power-law models for infectious disease spread. The Annals of Applied Statistics, 8 (3), 1612-1639. tools:::Rd_expr_doi("10.1214/14-AOAS743")
Sommariva, A. and Vianello, M. (2007). Product Gauss cubature over polygons based on Green's integration formula. BIT Numerical Mathematics, 47 (2), 441-453. tools:::Rd_expr_doi("10.1007/s10543-007-0131-2")
vignette("polyCub")
For the special case of a rectangular domain along the axes (e.g., a bounding box), the cubature package is more appropriate.