chaospy.expansion.stieltjes¶
- chaospy.expansion.stieltjes(order, dist, normed=False, graded=True, reverse=True, retall=False, cross_truncation=1.0)[source]¶
Create orthogonal polynomial expansion from three terms recurrence formula.
- Args:
- order (int):
Order of polynomial expansion.
- dist (Distribution):
Distribution space where polynomials are orthogonal If dist.ttr exists, it will be used. Must be stochastically independent.
- normed (bool):
If True orthonormal polynomials will be used.
- graded (bool):
Graded sorting, meaning the indices are always sorted by the index sum. E.g.
q0**2*q1**2*q2**2
has an exponent sum of 6, and will therefore be consider larger than bothq0**2*q1*q2
,q0*q1**2*q2
andq0*q1*q2**2
, which all have exponent sum of 5.- reverse (bool):
Reverse lexicographical sorting meaning that
q0*q1**3
is considered bigger thanq0**3*q1
, instead of the opposite.- retall (bool):
If true return numerical stabilized norms as well. Roughly the same as
cp.E(orth**2, dist)
.- cross_truncation (float):
Use hyperbolic cross truncation scheme to reduce the number of terms in expansion. only include terms where the exponents
K
satisfied the equationorder >= sum(K**(1/cross_truncation))**cross_truncation
.
- Returns:
- (numpoly.ndpoly, numpy.ndarray):
Orthogonal polynomial expansion. Norms of the orthogonal expansion on the form
E(orth**2, dist)
. Calculated using recurrence coefficients for stability.
- Examples:
>>> distribution = chaospy.J(chaospy.Normal(), chaospy.Normal()) >>> polynomials, norms = chaospy.expansion.stieltjes(2, distribution, retall=True) >>> polynomials.round(10) polynomial([1.0, q1, q0, q1**2-1.0, q0*q1, q0**2-1.0]) >>> norms.round(10) array([1., 1., 1., 2., 1., 2.]) >>> polynomials = chaospy.expansion.stieltjes(2, distribution, normed=True) >>> polynomials.round(3) polynomial([1.0, q1, q0, 0.707*q1**2-0.707, q0*q1, 0.707*q0**2-0.707])