Vectorized Integration
Vectorized adaptive Simpson integration.
quadv(f, a, b, tol = .Machine$double.eps^(1/2), ...)
f |
univariate, vector-valued function; need not be vectorized. |
a, b |
endpoints of the integration interval. |
tol |
acuracy required for the recursion step. |
... |
further parameters to be passed to the function |
Recursive version of the adaptive Simpson quadrature, recursion is based on the maximum of all components of the function calls.
quad
is not suitable for functions with singularities in the
interval or at end points.
Returns a list with components Q
the integral value, fcnt
the number of function calls, and estim.prec
the estimated precision
that normally will be much too high.
## Examples f1 <- function(x) c(sin(x), cos(x)) quadv(f1, 0, pi) # $Q # [1] 2.000000e+00 1.110223e-16 # $fcnt # [1] 65 # $estim.prec # [1] 4.321337e-07 f2 <- function(x) x^c(1:10) quadv(f2, 0, 1, tol = 1e-12) # $Q # [1] 0.50000000 0.33333333 0.25000000 0.20000000 0.16666667 # [6] 0.14285714 0.12500000 0.11111111 0.10000000 0.09090909 # $fcnt # [1] 505 # $estim.prec # [1] 2.49e-10
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.