Represents a numerical integrator that uses an adaptive algorithm based on a Gauss-Kronrod integration rule.

## Definition

Namespace: Extreme.Mathematics.Calculus
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
``public class AdaptiveIntegrator : NumericalIntegrator``
Inheritance
Object  →  ManagedIterativeAlgorithm<Double, Double, SolutionReport<Double, Double>>  →  ManagedIterativeAlgorithm<Double>  →  IterativeAlgorithm  →  NumericalIntegrator  →  AdaptiveIntegrator

## Remarks

The AdaptiveIntegrator class provides the most robust, reliable, and in most cases the fastest numerical integration algorithm. It uses a simple integration rule to approximate the integral over subintervals. In each step, the interval with the largest estimated error is divided in two, and new approximations for these two subintervals are calculated. This process continues until the total estimated error over all intervals is within the desired tolerance.

AdaptiveIntegrator inherits from NumericalIntegrator, the abstract base class for all numerical integration classes. It, in turn, inherits from the IterativeAlgorithm class. All properties of this class are also available. The AbsoluteTolerance and RelativeTolerance properties set the desired precision as specified by the ConvergenceCriterion property. The default value for both tolerances is SqrtEpsilon (roughly 10-8). MaxIterations sets the maximum number of iterations, which in this case is the maximum number of subintervals. The default value for this property is 5000. IterationsNeeded returns the actual number of iterations performed after the algorithm has completed.

The Integrate(Func<Double, Double>, Double, Double, Double[]) method does the actual work of numerically integrating an integrand. It takes three parameters. The first parameter is a function of one variable that specifies the function to integrate. The second and third parameters are Double values that specify the lower and upper bounds of the integration interval.

The IntegrationRule property lets you specify which integration rule to use to approximate integrals on a subinterval. Integration rules can be obtained by calling static methods of the IntegrationRule class. The default is the 31-point rule for normal integrands, and the 15-point rule when singularities are expected, and when integrating over infinite intervals. For oscillating integrands, the higher order rules will tend to give better results.

Several enhancements make this the integration algorithm of choice, especially for 'difficult' target functions.

An extra property, UseExtrapolation, lets you specify whether special precautions should be taken to deal with singularities. If UseExtrapolation is true, an extrapolation algorithm is used to approximate the integral near a singularity or singularities. Because this option requires extra resources, it is recommended only for integrands that actually have singularities inside or at the boundaries of the integration interval.

The SetSingularities(Double[]) and GetSingularities() methods let you specify and retrieve the points inside the integration interval where the integrand has a singularity or a discontinuity. They are returned as a Double array containing the problem points. Extrapolation is used once again to approximate the integral near the singularity or singularities. Specifying the problem points in the target function can lead to speed-ups of several orders of magnitude.

Unlike other classes, this integrator can deal successfully with infinite integration intervals. Specify NegativeInfinity or PositiveInfinity for one or both bounds of the integration interval. Internally, the class transforms the infinite interval to a finite interval, and performs the integration of the transformed integrand over the transformed interval.