Table of Contents

Class GaussianQuadrature

Namespace
NanoQL.Numerics
Assembly
NanoQL.dll

A Gaussian quadrature: the nodes and weights of an orthogonal polynomial's rule of a given order, from the eigen-decomposition of its recurrence's Jacobi matrix (G.H. Golub and J.H. Welsch, "Calculation of Gauss quadrature rules", Math. Comput. 23 (1969), 221-230), and the weighted sum of a function at the nodes.

public class GaussianQuadrature
Inheritance
GaussianQuadrature
Derived
Inherited Members

Remarks

A weight whose quotient overflows or underflows is formed in logarithms; one that can't be recovered, its eigenvector component zero, is dropped as QuantLib drops it. Order zero is refused: QuantLib allocates an array of n − 1 elements, which wraps (gaussianquadratures.cpp:41), and throws C++'s std::bad_array_new_length.

Constructors

GaussianQuadrature(int, GaussianOrthogonalPolynomial)

Initializes a new instance of the GaussianQuadrature class.

public GaussianQuadrature(int n, GaussianOrthogonalPolynomial orthPoly)

Parameters

n int

The order, positive.

orthPoly GaussianOrthogonalPolynomial

The orthogonal polynomial.

Exceptions

ArgumentNullException

orthPoly is null.

ArgumentOutOfRangeException

n is negative.

ArgumentException

n is zero.

Properties

Order

Gets the order, the number of nodes.

public int Order { get; }

Property Value

int

Methods

Evaluate(Func<double, double>)

The weighted sum of f at the nodes, from the last node to the first.

public double Evaluate(Func<double, double> f)

Parameters

f Func<double, double>

The function.

Returns

double

Σ wᵢ·f(xᵢ).

Exceptions

ArgumentNullException

f is null.

Weights()

The weights.

public Vector Weights()

Returns

Vector

A copy of the weights.

X()

The nodes.

public Vector X()

Returns

Vector

A copy of the nodes.