% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/polyCub.iso.R
\name{checkintrfr}
\alias{checkintrfr}
\title{Check the Integral of \eqn{r f_r(r)}}
\usage{
checkintrfr(intrfr, f, ..., center, control = list(), rs = numeric(0L),
  tolerance = control$rel.tol)
}
\arguments{
\item{intrfr}{a \code{function(R, ...)}, which implements the (analytical)
antiderivative of \eqn{r f_r(r)} from 0 to \code{R}. The first argument
must be vectorized but not necessarily named \code{R}.\cr
If \code{intrfr} is missing, it will be approximated numerically via
\preformatted{
  integrate(function(r, ...) r * f(cbind(x0 + r, y0), ...),
            0, R, ..., control = control)
}
where \code{c(x0, y0)} is the \code{center} of isotropy.
Note that \code{f} will \emph{not} be checked for isotropy.}

\item{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.}

\item{...}{further arguments for \code{f} or \code{intrfr}.}

\item{center}{numeric vector of length 2, the center of isotropy.}

\item{control}{list of arguments passed to \code{\link{integrate}}, the
quadrature rule used for the line integral along the polygon boundary.}

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

\item{tolerance}{of \code{\link{all.equal.numeric}} when comparing
\code{intrfr} results with numerical integration. Defaults to the
relative tolerance used for \code{integrate}.}
}
\value{
The \code{intrfr} function, invisibly. If only \code{f} was given,
an \code{integrate}-based approximation of \code{intrfr} is returned.
}
\description{
This function is auxiliary to \code{\link{polyCub.iso}}
for the cubature of a radially symmetric function
\eqn{f(x,y) = f_r(||(x,y)-\boldsymbol{\mu}||)}{f(x,y) = f_r(||(x,y)-\mu||)},
with \eqn{\mu} being the center of isotropy, over a polygonal domain.
The (analytical) integral of \eqn{r f_r(r)} from 0 to \eqn{R}, \code{intrfr},
is checked against an \code{\link{integrate}}-based approximation
for various values (\code{rs}) of the upper bound \eqn{R}.
A warning is issued if inconsistencies are found.
}
\examples{
f_const <- function (coords) rep(1, nrow(coords))
intrfr_const <- function (R) R^2/2  # = \int_0^R r f_r(r) dr
checkintrfr(intrfr_const,  f = f_const, center = c(0,0), rs = 1:10) # OK
checkintrfr(function(R) R, f = f_const, center = c(0,0), rs = 1:10) # warns
}
