chaospy.stieltjes

chaospy.stieltjes(order, dist, rule=None, tolerance=1e-16, scaling=3, n_max=5000)[source]

Stieltjes’ method.

Tries to get recurrence coefficients using the distributions own TTR-method, but will fall back to a iterative method if missing.

Args:
order (int):

The order create recurrence coefficients for.

dist (chaospy.Distribution):

The distribution to create recurrence coefficients with respect to.

rule (str):

The rule to use to create quadrature nodes and weights from.

tolerance (float):

The allowed relative error in norm between two quadrature orders before method assumes convergence.

scaling (float):

A multiplier the adaptive order increases with for each step quadrature order is not converged. Use 0 to indicate unit increments.

n_max (int):

The allowed number of quadrature points to use in approximation.

Returns:
(numpy.ndarray, numpy.ndarray, numpy.ndarray):
coefficients:

The recurrence coefficients created using the discretized Stieltjes’ method, with shape == (2, D, order+1).

polynomials:

The orthogonal polynomial expansion created as a by-product of the algorithm.

norms:

The norm of each orthogonal polynomial. Roughly equivalent to chaospy.E(polynomials**2, dist), but more numerically stable than most alternatives.

Examples:
>>> dist = chaospy.J(chaospy.Uniform(0, 1), chaospy.Beta(3, 4))
>>> (alpha, beta), orth, norms = chaospy.stieltjes(2, dist)
>>> alpha.round(5)
array([[0.5    , 0.5    , 0.5    ],
       [0.42857, 0.46032, 0.47475]])
>>> beta.round(5)
array([[1.     , 0.08333, 0.06667],
       [1.     , 0.03061, 0.04321]])
>>> orth[:, 2].round(5)
polynomial([q0**2-q0+0.16667, q1**2-0.88889*q1+0.16667])
>>> norms.round(5)
array([[1.     , 0.08333, 0.00556],
       [1.     , 0.03061, 0.00132]])