Learn R Programming

docopulae (version 0.2.1)

integrateA: Integrate Alternative

Description

integrateA is a tolerance wrapper for stats::integrate. It allows integrate to reach the maximum number of subdivisions.

Usage

integrateA(f, lower, upper, ..., subdivisions = 100L,
  rel.tol = .Machine$double.eps^0.25, abs.tol = rel.tol,
  stop.on.error = TRUE, keep.xy = FALSE, aux = NULL)

Arguments

f,lower,upper,...,subdivisions,rel.tol,abs.tol,stop.on.error,keep.xy,aux

Details

See integrate.

See Also

integrate

Examples

Run this code
f = function(x) ifelse(x < 0, cos(x), sin(x))
#curve(f(x), -1, 1)
try(integrate(f, -1, 1, subdivisions=1)$value)
integrateA(f, -1, 1, subdivisions=1)$value
integrateA(f, -1, 1, subdivisions=2)$value
integrateA(f, -1, 1, subdivisions=3)$value

Run the code above in your browser using DataLab