Integrate a user-written function of two variables over a rectangle
Source:R/callback.R
quadrature_2d.RdComputes the definite integral of f(x, y) over the rectangle [min_x, max_x] x [min_y, max_y] with either the ported adaptive Simpson rule or the globally adaptive
Gauss-Kronrod rule added in Numerics 2.2.
Usage
quadrature_2d(
f,
min_x,
max_x,
min_y,
max_y,
absolute_tolerance = NULL,
relative_tolerance = NULL,
min_depth = NULL,
max_depth = NULL,
max_function_evaluations = NULL,
method = c("adaptive_simpson", "adaptive_gauss_kronrod")
)Arguments
- f
a function taking two numbers (
x,y) and returning one number.- min_x, max_x, min_y, max_y
the bounds of the rectangle.
max_xmust be abovemin_x, andmax_yabovemin_y.- absolute_tolerance, relative_tolerance
the convergence tolerances on the difference between the whole-domain and quadrant-subdivided estimates, each between 1e-15 and 1.
NULL, the default, leaves the ported integrator's own defaults (1e-8) in force.- min_depth, max_depth
the recursion-depth bounds.
NULL, the default, leaves the ported class's own defaults (0 and 100) in force.- max_function_evaluations
maximum evaluations of
f.NULLleaves the selected integrator's default in force.- method
"adaptive_simpson"(the default) or"adaptive_gauss_kronrod".
Value
the integral, a single number, carrying the same three attributes quadrature()
returns: status, function_evaluations, and standard_error.