Learn R Programming

polyCub (version 0.9.1)

checkintrfr: Check the Integral of \(r f_r(r)\)

Description

This function is auxiliary to polyCub.iso. The (analytical) integral of \(r f_r(r)\) from 0 to \(R\) is checked against a numeric approximation using integrate for various values of the upper bound \(R\). A warning is issued if inconsistencies are found.

Usage

checkintrfr(intrfr, f, ..., center, control = list(), rs = numeric(0L),
  tolerance = control$rel.tol)

Value

The intrfr function. If it was not supplied, its quadrature version using integrate is returned.

Arguments

intrfr

a function(R, ...), which implements the (analytical) antiderivative of \(r f_r(r)\) from 0 to R. The first argument must be vectorized but not necessarily named R.
If intrfr is missing, it will be approximated numerically via integrate(function(r, ...) r * f(cbind(x0 + r, y0), ...), 0, R, ..., control=control), where c(x0, y0) is the center of isotropy. Note that f will not be checked for isotropy.

f

a two-dimensional real-valued function. As its first argument it must take a coordinate matrix, i.e., a numeric matrix with two columns, and it must return a numeric vector of length the number of coordinates.

...

further arguments for f or intrfr.

center

numeric vector of length 2, the center of isotropy.

control

list of arguments passed to integrate, the quadrature rule used for the line integral along the polygon boundary.

rs

numeric vector of upper bounds for which to check the validity of intrfr. If it has length 0 (default), no checks are performed.

tolerance

of all.equal.numeric when comparing intrfr results with numerical integration. Defaults to the relative tolerance used for integrate.