Source: https://doi.org/10.1137/S1064827501387826
Polynomial chaos expansion often assume that the polynomial expansion used is of the Wiener-Askey scheme veriaty. The reason for this is that the expansion in the scheme correspond to orthogonality with respect to some standard probability distribution.
There usually exists a few variations of the Wiener-Askey scheme. This is because of two reasons:
The former meas there is only one unique variation that is applicable in the context of uncertainty quantification. The latter is made unique by assuming that the leading coefficient to the largest exponent should be 1. But for convinience, the more canonical versions of the schemes will be listed as well here.
In chaospy
, though descrete distributions are supported, we will only focus on the continous cases.
In [1]:
import chaospy
distribution = chaospy.Normal(0, 1)
chaospy.orth_ttr(3, distribution)
Out[1]:
A multivariate expansion:
In [2]:
distribution = chaospy.J(
chaospy.Normal(0, 1), chaospy.Normal(0, 1))
chaospy.orth_ttr(3, distribution)[:6]
Out[2]:
The Hermite polynomials have classically a weight function $W(x) = e^{-x^2}$, and an expansion:
In [3]:
import numpy
distribution = chaospy.Normal(0, 1)
chaospy.orth_ttr(3, distribution)*2**numpy.arange(4)
Out[3]:
In [4]:
distribution = chaospy.Uniform(-1, 1)
chaospy.orth_ttr(3, distribution).round(4)
Out[4]:
A multivariate expansion:
In [5]:
distribution = chaospy.J(
chaospy.Uniform(-1, 1), chaospy.Uniform(-1, 1))
chaospy.orth_ttr(3, distribution)[:6].round(4)
Out[5]:
The Legendre polynomials have classically a weight function $W(x) = 1$ on the interval $[-1, 1]$, and an expansion:
In [6]:
distribution = chaospy.Uniform(-1, 1)
poly = chaospy.orth_ttr(3, distribution)
(poly/poly(1)).round(4)
Out[6]:
In [7]:
distribution = chaospy.Exponential()
chaospy.orth_ttr(2, distribution)
Out[7]:
A multivariate expansion:
In [8]:
distribution = chaospy.J(
chaospy.Exponential(), chaospy.Exponential())
chaospy.orth_ttr(2, distribution)[:5]
Out[8]:
The Laguerre polynomials have classically a weight function $W(x) = e^{-x}$, and an expansion:
In [9]:
distribution = chaospy.Exponential()
poly = chaospy.orth_ttr(3, distribution)
(poly/poly(0)).round(4)[:5]
Out[9]:
In [10]:
alpha = 2
distribution = chaospy.Gamma(alpha+1)
chaospy.orth_ttr(3, distribution)[:3]
Out[10]:
A multivariate expansion:
In [11]:
distribution = chaospy.J(
chaospy.Gamma(alpha+1), chaospy.Gamma(alpha+1))
chaospy.orth_ttr(3, distribution)[:6]
Out[11]:
The Generalized Laguerre polynomials have classically a weight function $W(x) = x^\alpha e^{-\alpha x}$, and an expansion:
In [12]:
poly1 = chaospy.orth_ttr(3, chaospy.Gamma(alpha+1))
poly2 = chaospy.orth_ttr(3, chaospy.Exponential())
(poly1/poly2(0)).round(4)
Out[12]:
In [13]:
alpha = 2
beta = 3
distribution = chaospy.Beta(alpha, beta)
chaospy.orth_ttr(3, distribution).round(4)
Out[13]:
A multivariate expansion:
In [14]:
distribution = chaospy.J(
chaospy.Beta(alpha, beta), chaospy.Beta(alpha, beta))
chaospy.orth_ttr(3, distribution)[:6].round(4)
Out[14]:
The Beta polynomials have classically a weight function: $W(x) = (1-x)^\alpha(1+x)^\beta$ over the interval $[-1, 1]$, and an expansion:
In [15]:
from scipy.special import comb
distribution = chaospy.Beta(alpha, beta, lower=-1, upper=1)
func = lambda n: numpy.sum(
comb(n+alpha, n-numpy.arange(n+1))*
comb(n+beta, numpy.arange(n+1))
)/2**n
coefficients = numpy.array([func(n) for n in range(4)])
(chaospy.orth_ttr(3, distribution)*coefficients).round(4)
Out[15]: