StandardDistributionPolynomialFactory¶
- class StandardDistributionPolynomialFactory(*args)¶
Build orthonormal or orthogonal univariate polynomial families.
- Parameters:
- arg
Distribution
orOrthonormalizationAlgorithm
Either a
Distribution
implementing the probability measure according to which the polynomial family is orthonormal or anOrthonormalizationAlgorithm
.In the first case, the implementation will switch to the suitable specific orthonormal univariate polynomial family if any (see the notes below), or it will default to the
AdaptiveStieltjesAlgorithm
to build an orthonormal univariate polynomial family.
- arg
Notes
Use this functionality with caution:
The polynomials exist if and only if the distribution admits finite moments of all orders. Even if some algorithms manage to compute something, it will be plain numerical noise.
Even if the polynomials exist, they form an Hilbertian basis with respect to the dot product induced by the distribution if and only if the distribution is determinate, ie is characterized by its moments. For example, the
LogNormal
distribution has orthonormal polynomials of arbitrary degree but the projection onto the functional space generated by these polynomials (seeFunctionalChaosAlgorithm
) may converge to a function that differs significantly from the function being projected (see [ernst2012]). See Functional Chaos Expansion for more details on this topic.
OpenTURNS implements the following specific orthonormal [1] univariate polynomial families together with their associated standard distributions.
Standard distribution
Polynomial
Aside, OpenTURNS also implements generic algorithms for building orthonormal univariate polynomial families with respect to any arbitrary probability measure (implemented as a
Distribution
). OpenTURNS implements the followingOrthonormalizationAlgorithm
’s,AdaptiveStieltjesAlgorithm
(default).Examples
>>> import openturns as ot
Build the specific orthonormal polynomial factory associated to the normal distribution (Hermite):
>>> polynomial_factory = ot.StandardDistributionPolynomialFactory(ot.Normal()) >>> for i in range(3): ... print(polynomial_factory.build(i)) 1 X -0.707107 + 0.707107 * X^2
Build an orthonormal polynomial factory for the WeibullMin distribution with the default orthonormalization algorithm:
>>> polynomial_factory = ot.StandardDistributionPolynomialFactory(ot.WeibullMin()) >>> for i in range(3): ... print(polynomial_factory.build(i)) 1 -1 + X 1 - 2 * X + 0.5 * X^2
Build an orthonormal polynomial factory for the log-normal distribution with Chebychev’s othonormalization algorithm:
>>> algorithm = ot.AdaptiveStieltjesAlgorithm(ot.WeibullMin()) >>> polynomial_factory = ot.StandardDistributionPolynomialFactory(algorithm) >>> for i in range(3): ... print(polynomial_factory.build(i)) 1 -1 + X 1 - 2 * X + 0.5 * X^2
Methods
build
(degree)Build the -th order orthogonal univariate polynomial.
buildCoefficients
(degree)Build the -th order orthogonal univariate polynomial coefficients.
Build the recurrence coefficients.
Accessor to the object's name.
Accessor to the specific family boolean.
Accessor to the associated probability measure.
getName
()Accessor to the object's name.
Build the -th order quadrature scheme.
Accessor to the orthonormalization algorithm.
Accessor to the recurrence coefficients of the -th order.
getRoots
(n)Accessor to the recurrence coefficients of the -th order.
Accessor to the specific orthonormal polynomial family.
hasName
()Test if the object is named.
setName
(name)Accessor to the object's name.
- __init__(*args)¶
- build(degree)¶
Build the -th order orthogonal univariate polynomial.
- Parameters:
- kint,
Polynomial order.
- Returns:
- polynomial
OrthogonalUniVariatePolynomial
Requested orthogonal univariate polynomial.
- polynomial
Examples
>>> import openturns as ot >>> polynomial_factory = ot.HermiteFactory() >>> print(polynomial_factory.build(2)) -0.707107 + 0.707107 * X^2
- buildCoefficients(degree)¶
Build the -th order orthogonal univariate polynomial coefficients.
- Parameters:
- kint,
Polynomial order.
- Returns:
- coefficients
Point
Coefficients of the requested orthogonal univariate polynomial.
- coefficients
Examples
>>> import openturns as ot >>> polynomial_factory = ot.HermiteFactory() >>> print(polynomial_factory.buildCoefficients(2)) [-0.707107,0,0.707107]
- buildRecurrenceCoefficientsCollection(degree)¶
Build the recurrence coefficients.
Build the recurrence coefficients of the orthogonal univariate polynomial family up to the -th order.
- Parameters:
- kint,
Polynomial order.
- Returns:
- recurrence_coefficientslist of
Point
All the tecurrence coefficients up to the requested order.
- recurrence_coefficientslist of
Examples
>>> import openturns as ot >>> polynomial_factory = ot.HermiteFactory() >>> print(polynomial_factory.buildRecurrenceCoefficientsCollection(2)) 0 : [ 1 0 0 ] 1 : [ 0.707107 0 -0.707107 ]
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getHasSpecificFamily()¶
Accessor to the specific family boolean.
- Returns:
- hasSpecificFamilybool
True if the factory has a specific orthogonal polynomial family.
- getMeasure()¶
Accessor to the associated probability measure.
- Returns:
- measure
Distribution
The associated probability measure (according to which the polynomials are orthogonal).
- measure
Notes
Two polynomials P and Q are orthogonal with respect to the probability measure if and only if their dot product:
where and .
Examples
>>> import openturns as ot >>> polynomial_factory = ot.HermiteFactory() >>> print(polynomial_factory.getMeasure()) Normal(mu = 0, sigma = 1)
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getNodesAndWeights(n)¶
Build the -th order quadrature scheme.
Associated with the orthogonal univariate polynomials family.
- Parameters:
- kint,
Polynomial order.
- Returns:
Examples
>>> import openturns as ot >>> polynomial_factory = ot.HermiteFactory() >>> nodes, weights = polynomial_factory.getNodesAndWeights(3) >>> print(nodes) [-1.73205,...,1.73205] >>> print(weights) [0.166667,0.666667,0.166667]
- getOrthonormalizationAlgorithm()¶
Accessor to the orthonormalization algorithm.
- Returns:
- orthonormalizationAlgorithm
OrthonormalizationAlgorithm
The univariate polynomial orthonormalization algorithm.
- orthonormalizationAlgorithm
- getRecurrenceCoefficients(n)¶
Accessor to the recurrence coefficients of the -th order.
Of the orthogonal univariate polynomial.
- Parameters:
- kint,
Polynomial order.
- Returns:
- recurrence_coefficients
Point
The recurrence coefficients of the -th order orthogonal univariate polynomial.
- recurrence_coefficients
Notes
Any sequence of orthogonal polynomials has a recurrence formula relating any three consecutive polynomials as follows:
Examples
>>> import openturns as ot >>> polynomial_factory = ot.HermiteFactory() >>> print(polynomial_factory.getRecurrenceCoefficients(3)) [0.5,0,-0.866025]
- getRoots(n)¶
Accessor to the recurrence coefficients of the -th order.
Of the orthogonal univariate polynomial.
- Parameters:
- kint,
Polynomial order.
- Returns:
- roots
Point
The roots of the -th order orthogonal univariate polynomial.
- roots
Examples
>>> import openturns as ot >>> polynomial_factory = ot.HermiteFactory() >>> print(polynomial_factory.getRoots(3)) [-1.73205,...,1.73205]
- getSpecificFamily()¶
Accessor to the specific orthonormal polynomial family.
- Returns:
- specificFamily
OrthogonalUniVariatePolynomialFamily
The specific orthonormal univariate polynomial family.
- specificFamily
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
Examples using the class¶
Create a full or sparse polynomial chaos expansion
Advanced polynomial chaos construction