Description Usage Arguments Details Value Note Examples
Integrate a multivariate function (R^p -> R).
1 | integrate.mv(f, lower, upper, stop.on.error = FALSE, ...)
|
f |
Function that takes a vector and returns a numeric. |
lower, |
upper Vector of the limits of integration for
each variable entered into |
stop.on.error |
Logical (an argument of |
... |
Other arguments to pass into |
This function recursively integrates the arguments in f
using the integrate function.
It's reasonably fast
when f takes two variables, and slow when f takes 3 variables.
For 4 or more, perhaps look into alternative approaches.
If you're support is finite, you're better off using
cubature::adaptIntegrate.
A numeric value of the integral. The other information
outputted by the integrate function are ignored.
If the length of the limit vectors is zero, it will be assumed that
f has no arguments, so f() will be returned.
returned.
Only a rectangular support is allowed.
This function could probably be improved if some of the support is finite,
in which case somehow cubature::adaptIntegrate could be
leveraged somehow.
The stop.on.error argument is defaulted to FALSE
instead of integrate's TRUE because sometimes
it'll think the integral is divergent when it's really not.
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.