MultiFunctionMathIntegrate Method (FuncIReadOnlyListDouble, Double, IReadOnlyListInterval, IntegrationSettings) |
Estimates a multi-dimensional integral using the given evaluation settings.
Namespace:
Meta.Numerics.Analysis
Assembly:
Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax public static IntegrationResult Integrate(
Func<IReadOnlyList<double>, double> function,
IReadOnlyList<Interval> volume,
IntegrationSettings settings
)
Public Shared Function Integrate (
function As Func(Of IReadOnlyList(Of Double), Double),
volume As IReadOnlyList(Of Interval),
settings As IntegrationSettings
) As IntegrationResult
public:
static IntegrationResult^ Integrate(
Func<IReadOnlyList<double>^, double>^ function,
IReadOnlyList<Interval>^ volume,
IntegrationSettings^ settings
)
static member Integrate :
function : Func<IReadOnlyList<float>, float> *
volume : IReadOnlyList<Interval> *
settings : IntegrationSettings -> IntegrationResult
Parameters
- function
- Type: SystemFuncIReadOnlyListDouble, Double
The function to be integrated. - volume
- Type: System.Collections.GenericIReadOnlyListInterval
The volume over which to integrate. - settings
- Type: Meta.Numerics.AnalysisIntegrationSettings
The integration settings.
Return Value
Type:
IntegrationResultA numerical estimate of the multi-dimensional integral.
Exceptions Exception | Condition |
---|
ArgumentException | function, volume, or settings are null, or
the dimension of volume is larger than 15. |
NonconvergenceException | The prescribed accuracy could not be achieved with the given evaluation budget. |
Remarks Note that the integration function must not attempt to modify the argument passed to it.
Note that the integration volume must be a hyper-rectangle. You can integrate over regions with more complex boundaries by specifying the integration
volume as a bounding hyper-rectangle that encloses your desired integration region, and returing the value 0 for the integrand outside of the desired integration
region. For example, to find the volume of a unit d-sphere, you can integrate a function that is 1 inside the unit d-sphere and 0 outside it over the volume
[-1,1]d. You can integrate over infinite volumes by specifing volume endpoints of PositiveInfinity and/or
NegativeInfinity. Volumes with dimension greater than 15 are not currently supported.
Integrals with hard boundaries (like our hyper-sphere volume problem) typically require more evaluations than integrals of smooth functions to achieve the same accuracy.
Integrals with canceling positive and negative contributions also typically require more evaluations than integtrals of purely positive functions.
Numerical multi-dimensional integration is computationally expensive. To make problems more tractable, keep in mind some rules of thumb:
- Reduce the required accuracy to the minimum required. Alternatively, if you are willing to wait longer, increase the evaluation budget.
- Exploit symmetries of the problem to reduce the integration volume. For example, to compute the volume of the unit d-sphere, it is better to
integrate over [0,1]d and multiply the result by 2d than to simply integrate over [-1,1]d.
- Apply analytic techniques to reduce the dimension of the integral. For example, when computing the volume of the unit d-sphere, it is better
to do a (d-1)-dimesional integral over the function that is the height of the sphere in the dth dimension than to do a d-dimensional integral over the
indicator function that is 1 inside the sphere and 0 outside it.
See Also