tensap.functions.polynomials package

Submodules

tensap.functions.polynomials.orthonormal_polynomials module

Module orthonormal_polynomials.

class tensap.functions.polynomials.orthonormal_polynomials.DiscretePolynomials(measure=None)

Bases: tensap.functions.polynomials.orthonormal_polynomials.OrthonormalPolynomials

Class DiscretePolynomials.

Polynomials orthonormal with respect to a discrete measure.

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

domain()

Return the support of the associated measure.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind[, measure])

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind[, measure])

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

random(ind[, n, measure])

Return an array of size n of random evaluations of the polynomials for which the degree is in ind.

roots(deg)

Return the roots of the polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated measure.

class tensap.functions.polynomials.orthonormal_polynomials.EmpiricalPolynomials(sample, n=None)

Bases: tensap.functions.polynomials.orthonormal_polynomials.OrthonormalPolynomials

Class EmpiricalPolynomials.

Polynomials defined on R and orthonormal with respect to the gaussian kernel smoothed distribution based on a sample x, which was centered and normalized (unit variance).

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

domain()

Return the support of the associated measure.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind[, measure])

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind[, measure])

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

random(ind[, n, measure])

Return an array of size n of random evaluations of the polynomials for which the degree is in ind.

roots(deg)

Return the roots of the polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated measure.

class tensap.functions.polynomials.orthonormal_polynomials.HermitePolynomials(n=50)

Bases: tensap.functions.polynomials.orthonormal_polynomials.OrthonormalPolynomials

Class HermitePolynomials.

Polynomials defined on R and orthonormal with respect to the standard gaussian measure 1/sqrt(2*pi)*exp(-x^2/2).

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

domain()

Return the support of the associated measure.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind[, measure])

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind[, measure])

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

random(ind[, n, measure])

Return an array of size n of random evaluations of the polynomials for which the degree is in ind.

roots(deg)

Return the roots of the polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated measure.

class tensap.functions.polynomials.orthonormal_polynomials.LegendrePolynomials(n=50)

Bases: tensap.functions.polynomials.orthonormal_polynomials.OrthonormalPolynomials

Class LegendrePolynomials.

Polynomials defined on [-1,1], orthonormal with respect to the standard uniform measure 1/2.

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

domain()

Return the support of the associated measure.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind[, measure])

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind[, measure])

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

random(ind[, n, measure])

Return an array of size n of random evaluations of the polynomials for which the degree is in ind.

roots(deg)

Return the roots of the polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated measure.

class tensap.functions.polynomials.orthonormal_polynomials.OrthonormalPolynomials

Bases: tensap.functions.polynomials.polynomials.UnivariatePolynomials

Class OrthonormalPolynomials.

Attributes
measuretensap.Measure

The measure associated with the orthonormal polynomials.

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

domain()

Return the support of the associated measure.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind[, measure])

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind[, measure])

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

random(ind[, n, measure])

Return an array of size n of random evaluations of the polynomials for which the degree is in ind.

roots(deg)

Return the roots of the polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated measure.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the derivatives of the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the first order derivatives of the selected polynomials at the points x.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the derivatives of the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the n-th order derivatives of the selected polynomials at the points x.

domain()

Return the support of the associated measure.

Returns
numpy.ndarray

The support of the associated measure.

static is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

Returns
bool

Indicates if the polynomials are orthonormal.

moment(ind, measure=None)

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

The integral is with respect to a measure mu which is taken as the measure to the polynomials if not provided in input

Assuming ind is a numpy.ndarray:
  • if ind.ndim == 1, and ind is of length N, return the float

    m = int p_ind[0](x)…p_ind[N-1](x) dmu(x),

  • else if ind.ndim == 2, and ind is N-by-M,

    return the vector m of length N such that m[j] = int p_ind[j, 0](x)…p_ind[j, M-1](x) dmu(x)

Parameters
indlist or numpy.ndarray

Contains the degrees of the considered polynomials.

measuretensap.Measure, optional

The measure used for the computation of the moments. The default is None, indicating to use self.measure.

Returns
numpy.ndarray

Contains the integrals of products of polynomials.

static one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

Parameters
indind or numpy.ndarray

The orders of the polynomials to be evaluated.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the selected polynomials at the points x.

random(ind, n=1, measure=None)

Return an array of size n of random evaluations of the polynomials for which the degree is in ind. If measure is not provided, the random generation is performed using self.measure.

Parameters
indlist or numpy.ndarray

The indices of the polynomials to be evaluated.

nint, optional

The number of random evaluations. The default is 1.

measuretensap.ProbabilityMeasure, optional

The probability measure used for the generation of the input points. The default is None, indicating to use self.measure.

Returns
outnumpy.ndarray

The random evaluations of the polynomials.

xnumpy.ndarray

The randomly drawn input points.

roots(deg)

Return the roots of the polynomial of degree deg.

Parameters
degint

The degree of the polynomial for which the roots are to be computed.

Returns
numpy.ndarray

The roots of the polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated measure.

Returns
numpy.ndarray

The truncated support of the associated measure.

class tensap.functions.polynomials.orthonormal_polynomials.ShiftedOrthonormalPolynomials(polynomials, shift, scaling)

Bases: tensap.functions.polynomials.polynomials.UnivariatePolynomials

Class ShiftedOrthonormalPolynomials.

Attributes
measuretensap.Measure

The measure associated with the ShiftedOrthonormalPolynomials.

polynomialstensap.OrthonormalPolynomials

The OrthonormalPolynomials which are shifted.

shiftfloat

The shifting parameter.

scalingfloat

The scaling parameter.

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

domain()

Return the support of the associated shifted measure.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind, *measure)

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind, *measure)

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff()

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

random(ind[, n, measure])

Return an array of size n of random evaluations of the shifted polynomials for which the degree is in ind.

roots(n)

Return the roots of the shifted polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated shifted measure.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the derivatives of the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the first order derivatives of the selected polynomials at the points x.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the derivatives of the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the n-th order derivatives of the selected polynomials at the points x.

domain()

Return the support of the associated shifted measure.

Returns
numpy.ndarray

The support of the associated measure.

static is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

Returns
bool

Indicates if the polynomials are orthonormal.

mean(ind, *measure)

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials for which the mean is to be computed.

measuretensap.Measure, optional

The measure used for the computation of the mean. The default is None, indicating to use self.measure.

Returns
numpy.ndarray

The mean of the selected polynomials.

moment(ind, *measure)

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

The integral is with respect to a measure mu which is taken as the measure to the polynomials if not provided in input

Assuming ind is a numpy.ndarray:
  • if ind.ndim == 1, and ind is of length N, return the float

    m = int p_ind[0](x)…p_ind[N-1](x) dmu(x),

  • else if ind.ndim == 2, and ind is N-by-M,

    return the vector m of length N such that m[j] = int p_ind[j, 0](x)…p_ind[j, M-1](x) dmu(x)

Parameters
indlist or numpy.ndarray

Contains the degrees of the considered polynomials.

measuretensap.Measure, optional

The measure used for the computation of the moments. The default is None, indicating to use self.measure.

Returns
numpy.ndarray

Contains the integrals of products of polynomials.

static ndim()

Return the dimension of the output of the polynomials.

Returns
int

The dimension of the output of the polynomials.

static one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

static poly_coeff()

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

Parameters
indind or numpy.ndarray

The orders of the polynomials to be evaluated.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the selected polynomials at the points x.

random(ind, n=1, measure=None)

Return an array of size n of random evaluations of the shifted polynomials for which the degree is in ind. If measure is not provided, the random generation is performed using self.measure.

Parameters
indlist or numpy.ndarray

The indices of the polynomials to be evaluated.

nint, optional

The number of random evaluations. The default is 1.

measuretensap.ProbabilityMeasure, optional

The probability measure used for the generation of the input points. The default is None, indicating to use self.measure.

Returns
fxnumpy.ndarray

The random evaluations of the polynomials.

xnumpy.ndarray

The randomly drawn input points.

roots(n)

Return the roots of the shifted polynomial of degree deg.

Parameters
degint

The degree of the polynomial for which the roots are to be computed.

Returns
numpy.ndarray

The roots of the polynomial of degree deg.

truncated_domain()

Return the truncated support of the associated shifted measure.

Returns
numpy.ndarray

The truncated support of the associated measure.

tensap.functions.polynomials.polynomials module

Module polynomials.

class tensap.functions.polynomials.polynomials.CanonicalPolynomials(measure=None)

Bases: tensap.functions.polynomials.polynomials.UnivariatePolynomials

Class CanonicalPolynomials.

Attributes
measureNone or tensap.Measure

The measure associated with the canonical polynomials.

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

domain()

Return the domain of the canonical polynomials.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind[, measure])

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind[, measure])

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the derivatives of the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the first order derivatives of the selected polynomials at the points x.

static domain()

Return the domain of the canonical polynomials.

Returns
list

The domain of the canonical polynomials.

static is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

Returns
bool

Indicates if the polynomials are orthonormal.

static one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

Parameters
indind or numpy.ndarray

The orders of the polynomials to be evaluated.

class tensap.functions.polynomials.polynomials.UnivariatePolynomials

Bases: abc.ABC

Class UnivariatePolynomials.

Methods

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

mean(ind[, measure])

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

moment(ind[, measure])

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

ndim()

Return the dimension of the output of the polynomials.

one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

d_poly_coef(ind)

Return the coefficients of the first order derivative of the polynomials of degrees contained in ind.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

Returns
numpy.ndarray

The coefficients of the first order derivative of the polynomials of order contained in ind.

d_polyval(ind, x)

Evaluate the first order derivative of the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the derivatives of the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the first order derivatives of the selected polynomials at the points x.

dn_poly_coeff(n, ind)

Return the coefficients of the n-th order derivative of the polynomials of degrees contained in ind.

Parameters
nint

The degrees of derivation of the polynomials.

indlist or numpy.ndarray

The orders of the polynomials to be evaluated.

Returns
numpy.ndarray

The coefficients of the n-th order derivative of the polynomials of order contained in ind.

dn_polyval(n, ind, x)

Evaluate the n-th order derivative of the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the derivatives of the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the n-th order derivatives of the selected polynomials at the points x.

abstract is_orthonormal()

Check the orthonormality of the basis created by the functions of self.

Returns
bool

Indicates if the polynomials are orthonormal.

mean(ind, measure=None)

Return the mean of the polynomials of degrees contained in ind, with a Measure given by measure if provided, or to self.measure otherwise.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials for which the mean is to be computed.

measuretensap.Measure, optional

The measure used for the computation of the mean. The default is None, indicating to use self.measure.

Returns
numpy.ndarray

The mean of the selected polynomials.

moment(ind, measure=None)

Return the integral of products of polynomials p_i, i in ind, using a gauss integration rule.

The integral is with respect to a measure mu which is taken as the measure to the polynomials if not provided in input

Assuming ind is a numpy.ndarray:
  • if ind.ndim == 1, and ind is of length N, return the float

    m = int p_ind[0](x)…p_ind[N-1](x) dmu(x),

  • else if ind.ndim == 2, and ind is N-by-M,

    return the vector m of length N such that m[j] = int p_ind[j, 0](x)…p_ind[j, M-1](x) dmu(x)

Parameters
indlist or numpy.ndarray

Contains the degrees of the considered polynomials.

measuretensap.Measure, optional

The measure used for the computation of the moments. The default is None, indicating to use self.measure.

Returns
numpy.ndarray

Contains the integrals of products of polynomials.

static ndim()

Return the dimension of the output of the polynomials.

Returns
int

The dimension of the output of the polynomials.

abstract one()

Coefficients and corresponding indices for the decomposition of the constant function 1.

abstract poly_coeff(ind)

Compute the coefficients of the monomials used to create the polynomials of degree specified in ind.

Parameters
indind or numpy.ndarray

The orders of the polynomials to be evaluated.

polyval(ind, x)

Evaluate the polynomials of degrees contained in ind at the points x.

Parameters
indlist or numpy.ndarray

The degrees of the polynomials to be evaluated.

xlist or numpy.ndarray

The points at which the polynomials are to be evaluated.

Returns
numpy.ndarray

The evaluation of the selected polynomials at the points x.

Module contents