Meta.Numerics Library

## FunctionMathIntegrate Method (FuncDouble, Double, Double, Double, IntegrationSettings) |

Evaluates a definite integral with the given evaluation settings.

Syntax

public static IntegrationResult Integrate( Func<double, double> integrand, double start, double end, IntegrationSettings settings )

- integrand
- Type: SystemFuncDouble, Double

The function to be integrated. - start
- Type: SystemDouble

The left integration endpoint. - end
- Type: SystemDouble

The right integration endpoint. - settings
- Type: Meta.Numerics.AnalysisIntegrationSettings

The settings which control the evaluation of the integral.

The result of the integral.

Exceptions

Exception | Condition |
---|---|

ArgumentNullException | The integrand is . |

NonconvergenceException | The maximum number of function evaluations was exceeded before the integral could be determined to the required precision. |

Remarks

To do integrals over infinite regions, simply set start or end to NegativeInfinity or PositiveInfinity.

Our integrator handles smooth functions extremely efficiently. It handles integrands with discontinuities or kinks at the price of slightly more evaluations of the integrand. It can handle oscillatory functions, as long as cancelation between positive and negative regions is not too severe. It can integrate logarithmic and mild power-law singularities.

Strong power-law singularities will cause the algorithm to fail with a NonconvergenceException.
This is unavoidable for essentially any double-precision numerical integrator. Consider, for example,
the integrable singularity x^{-1/2}. Since
ε = ∫_{0}^{δ} x^{-1/2} dx = 2 δ^{1/2},
points within δ ∼ 10^{-16} of the end-points, which as a close as you can get to
a point in double precision without being on top of it, contribute at the ε ∼ 10^{-8}
level to our integral, well beyond limit that nearly-full double precision requires. Said differently,
to know the value of the integral to ε ∼ 10^{-16} precision, we would need to
evaluate the contributions of points within δ ∼ 10^{-32} of the endpoints,
which is far closer than we can get.

If you need to evaluate an integral with such a strong singularity, try to make an analytic
change of variable to absorb the singularity before attempting numerical integration. For example,
to evaluate I = ∫_{0}^{b} f(x) x^{-1/2} dx, substitute y = x^{1/2}
to obtain I = 2 ∫_{0}^{√b} f(y^{2}) dy.

To do multi-dimensional integrals, use Integrate(FuncIReadOnlyListDouble, Double, IReadOnlyListInterval, IntegrationSettings).

See Also