MeixnerFactory

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

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

Meixner specific orthonormal univariate polynomial family.

For the NegativeBinomial distribution.

Available constructors:
MeixnerFactory(r=1.0, p=0.5)
Parameters:

r : float, r > 0

Number of failures parameter of the NegativeBinomial distribution.

p : float, 0 < p < 1

Success probability parameter of the NegativeBinomial distribution.

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 Meixner polynomials come analytically and read:

\begin{array}{rcl}
    a_i & = & \displaystyle \frac{p - 1}
                                 {\sqrt{p (i + 1) (i + r)}} \\
    b_i & = & \displaystyle \frac{p (i + r) + i}
                                 {\sqrt{p (i + 1) (i + r)}} \\
    c_i & = & \displaystyle - \frac{\sqrt{p i (i + r - 1)}}
                                   {\sqrt{p (i + 1) (i + r)}} \\
\end{array}, \quad 1 < i

where r and p are the parameters of the NegativeBinomial distribution.

Examples

>>> import openturns as ot
>>> polynomial_factory = ot.MeixnerFactory()
>>> for i in range(3):
...     print(polynomial_factory.build(i))
1
0.707107 - 0.707107 * X
0.5 - 1.25 * X + 0.25 * X^2

Methods

build(degree) Build the k-th order orthogonal univariate polynomial.
buildCoefficients(degree) Build the k-th order orthogonal univariate polynomial coefficients.
buildRecurrenceCoefficientsCollection(degree) Build the recurrence coefficients.
getClassName() Accessor to the object’s name.
getId() Accessor to the object’s id.
getMeasure() Accessor to the associated probability measure.
getName() Accessor to the object’s name.
getNodesAndWeights(n) Build the k-th order quadrature scheme.
getP() Accessor to the success probability parameter p.
getR() Accessor to the number of failures parameter r.
getRecurrenceCoefficients(n) Accessor to the recurrence coefficients of the k-th order.
getRoots(n) Accessor to the recurrence coefficients of the k-th order.
getShadowedId() Accessor to the object’s shadowed id.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
build(degree)

Build the k-th order orthogonal univariate polynomial.

Parameters:

k : int, 0 \leq k

Polynomial order.

Returns:

polynomial : OrthogonalUniVariatePolynomial

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(degree)

Build the k-th order orthogonal univariate polynomial coefficients.

Parameters:

k : int, 0 \leq k

Polynomial order.

Returns:

coefficients : Point

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(degree)

Build the recurrence coefficients.

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

Parameters:

k : int, 0 \leq k

Polynomial order.

Returns:

recurrence_coefficients : list 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]]
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

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

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getMeasure()

Accessor to the associated probability measure.

Returns:

measure : Distribution

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()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getNodesAndWeights(n)

Build the k-th order quadrature scheme.

Associated with the orthogonal univariate polynomials family.

Parameters:

k : int, 0 < k

Polynomial order.

Returns:

nodes : Point

The nodes of the k-th order quadrature scheme.

weights : Point

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]
getP()

Accessor to the success probability parameter p.

Of the NegativeBinomial distribution.

Returns:

p : float

Success probability parameter of the NegativeBinomial distribution.

getR()

Accessor to the number of failures parameter r.

Of the NegativeBinomial distribution.

Returns:

r : int

Number of failures parameter of the NegativeBinomial distribution.

getRecurrenceCoefficients(n)

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

Of the orthogonal univariate polynomial.

Parameters:

k : int, 0 \leq k

Polynomial order.

Returns:

recurrence_coefficients : Point

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(n)

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

Of the orthogonal univariate polynomial.

Parameters:

k : int, k > 0

Polynomial order.

Returns:

roots : Point

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()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

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

setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.