JacobiFactory

(Source code, png, hires.png, pdf)

../../_images/openturns-JacobiFactory-1.png
class JacobiFactory(*args)

Jacobi specific orthonormal univariate polynomial family.

For the Beta distribution.

Available constructors:

Jacobi(arg1=1.0, arg2=1.0, parameters_set=ot.JacobiFactory.ANALYSIS)

Parameters
arg1float

If parameters_set == ot.JacobiFactory.PROBABILITY: default shape parameter r > 0 of the Beta distribution.

If parameters_set == ot.JacobiFactory.ANALYSIS: alternative shape parameter \alpha = t - r - 1 > -1 of the Beta distribution.

arg2float

If parameters_set == ot.JacobiFactory.PROBABILITY: default shape parameter t > r of the Beta distribution.

If parameters_set == ot.JacobiFactory.ANALYSIS: alternative shape parameter \beta = r - 1 of the Beta distribution.

parameters_setint, optional

Integer telling which parameters set is used for defining the distribution (amongst ot.JacobiFactory.ANALYSIS, ot.JacobiFactory.PROBABILITY).

Notes

Any sequence of orthogonal polynomials has a recurrence formula relating any three consecutive polynomials as follows:

P_{i + 1} = (a_i x + b_i) P_i + c_i P_{i - 1}, \quad 1 < i

The recurrence coefficients for the Jacobi polynomials come analytically and read:

\begin{array}{rcl}
    a_i & = & \displaystyle K_{2,i} (2 i + \alpha + \beta + 2) \\
    b_i & = & \displaystyle K_{2,i} \frac{(\alpha - \beta)(\alpha + \beta)}
                                         {2 i + \alpha + \beta} \\
    c_i & = & \displaystyle - \frac{2 i + \alpha + \beta + 2}
                                   {2 i + \alpha + \beta}
                            \left[(i + \alpha) (i + \beta)
                                  (i + \alpha + \beta) i
                                  \frac{K_{1,i}}
                                       {2 i + \alpha + \beta - 1}
                                  \right]^{1/2}
\end{array}, \quad 1 < i

where \alpha and \beta are the alternative shape parameters of the Beta distribution, and:

\begin{array}{rcl}
    K_{1,i} & = & \displaystyle \frac{2 i + \alpha + \beta + 3}
                                     {(i + 1) (i + \alpha + 1)
                                      (i + \beta + 1)
                                      (i + \alpha + \beta + 1)} \\
    K_{2,i} & = & \displaystyle \frac{1}{2}
                                \sqrt{(2 i + \alpha + \beta + 1) K_{1,i}}
\end{array}, \quad i > 1

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.JacobiFactory()
>>> for i in range(3):
...     print(polynomial_factory.build(i))
1
2.23607 * X
-0.935414 + 4.67707 * X^2

Methods

build(self, degree)

Build the k-th order orthogonal univariate polynomial.

buildCoefficients(self, degree)

Build the k-th order orthogonal univariate polynomial coefficients.

buildRecurrenceCoefficientsCollection(self, …)

Build the recurrence coefficients.

getAlpha(self)

Accessor to the alternative shape parameter \alpha.

getBeta(self)

Accessor to the alternative shape parameter \beta.

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getMeasure(self)

Accessor to the associated probability measure.

getName(self)

Accessor to the object’s name.

getNodesAndWeights(self, n)

Build the k-th order quadrature scheme.

getRecurrenceCoefficients(self, n)

Accessor to the recurrence coefficients of the k-th order.

getRoots(self, n)

Accessor to the recurrence coefficients of the k-th order.

getShadowedId(self)

Accessor to the object’s shadowed id.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

setName(self, name)

Accessor to the object’s name.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

build(self, degree)

Build the k-th order orthogonal univariate polynomial.

Parameters
kint, 0 \leq k

Polynomial order.

Returns
polynomialOrthogonalUniVariatePolynomial

Requested orthogonal univariate polynomial.

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.HermiteFactory()
>>> print(polynomial_factory.build(2))
-0.707107 + 0.707107 * X^2
buildCoefficients(self, degree)

Build the k-th order orthogonal univariate polynomial coefficients.

Parameters
kint, 0 \leq k

Polynomial order.

Returns
coefficientsPoint

Coefficients of the requested orthogonal univariate polynomial.

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.HermiteFactory()
>>> print(polynomial_factory.buildCoefficients(2))
[-0.707107,0,0.707107]
buildRecurrenceCoefficientsCollection(self, degree)

Build the recurrence coefficients.

Build the recurrence coefficients of the orthogonal univariate polynomial family up to the k-th order.

Parameters
kint, 0 \leq k

Polynomial order.

Returns
recurrence_coefficientslist of Point

All the tecurrence coefficients up to the requested order.

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.HermiteFactory()
>>> print(polynomial_factory.buildRecurrenceCoefficientsCollection(2))
[[1,0,0],[0.707107,0,-0.707107]]
getAlpha(self)

Accessor to the alternative shape parameter \alpha.

Of the Beta distribution.

Returns
alphafloat

Alternative shape parameter \alpha = r - 1 of the Beta distribution.

getBeta(self)

Accessor to the alternative shape parameter \beta.

Of the Beta distribution.

Returns
betafloat

Alternative shape parameter \beta = t - r - 1 of the Beta distribution.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getMeasure(self)

Accessor to the associated probability measure.

Returns
measureDistribution

The associated probability measure (according to which the polynomials are orthogonal).

Notes

Two polynomials P and Q are orthogonal with respect to the probability measure w(x) \di{x} if and only if their dot product:

\langle P, Q \rangle = \int_{\alpha}^{\beta} P(x) Q(x) w(x)\di{x}
                     = 0

where \alpha \in \Rset \cup \{-\infty\} and \beta \in \Rset \cup \{+\infty\}.

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.HermiteFactory()
>>> print(polynomial_factory.getMeasure())
Normal(mu = 0, sigma = 1)
getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getNodesAndWeights(self, n)

Build the k-th order quadrature scheme.

Associated with the orthogonal univariate polynomials family.

Parameters
kint, 0 < k

Polynomial order.

Returns
nodesPoint

The nodes of the k-th order quadrature scheme.

weightsPoint

The weights of the k-th order quadrature scheme.

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]
getRecurrenceCoefficients(self, n)

Accessor to the recurrence coefficients of the k-th order.

Of the orthogonal univariate polynomial.

Parameters
kint, 0 \leq k

Polynomial order.

Returns
recurrence_coefficientsPoint

The recurrence coefficients of the k-th order orthogonal univariate polynomial.

Notes

Any sequence of orthogonal polynomials has a recurrence formula relating any three consecutive polynomials as follows:

P_{-1}=0, P_0=1, P_{n + 1} = (a_n x + b_n) P_n + c_n P_{n - 1}, \quad n > 1

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.HermiteFactory()
>>> print(polynomial_factory.getRecurrenceCoefficients(3))
[0.5,0,-0.866025]
getRoots(self, n)

Accessor to the recurrence coefficients of the k-th order.

Of the orthogonal univariate polynomial.

Parameters
kint, k > 0

Polynomial order.

Returns
rootsPoint

The roots of the k-th order orthogonal univariate polynomial.

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.HermiteFactory()
>>> print(polynomial_factory.getRoots(3))
[-1.73205,...,1.73205]
getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.