Table of Contents

Class DiscreteSimpsonIntegrator

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

Simpson's rule on a fixed number of evenly spaced evaluations of a function over [a, b], the ends included, an odd number of intervals closed by QuantLib's end correction.

public sealed class DiscreteSimpsonIntegrator : Integrator
Inheritance
DiscreteSimpsonIntegrator
Inherited Members

Remarks

Immutable. Its accuracy is QuantLib's Null<Real>(): the rule runs its evaluations and reports no error. Fewer than two evaluations are refused, where QuantLib's count wraps below zero (discreteintegrals.cpp:92); at two, one interval, the trapezoid rule, where QuantLib's end correction counts f(a) a second time (2.52581 where its DiscreteSimpsonIntegral on the same two points gives the trapezoid's 1.85914). From three evaluations, QuantLib's arithmetic.

Constructors

DiscreteSimpsonIntegrator(int)

Initializes a new instance of the DiscreteSimpsonIntegrator class.

public DiscreteSimpsonIntegrator(int evaluations)

Parameters

evaluations int

The number of evaluations, at least 2.

Exceptions

ArgumentOutOfRangeException

evaluations is below 2.

Methods

IntegrateCore(Func<double, double>, double, double)

The rule's integral over [a, b], a below b, with the number of evaluations it made and its error estimate, if it computes one.

protected override IntegrationResult IntegrateCore(Func<double, double> f, double a, double b)

Parameters

f Func<double, double>

The integrand.

a double

The lower limit.

b double

The upper limit.

Returns

IntegrationResult

The integral, the number of evaluations and the error estimate, or null for none.

Exceptions

NanoQLException

The evaluations were set below 2 (SetMaxEvaluations(int)).