MultivariateBases

MultivariateBases.jl is a standardized API for multivariate polynomial bases based on the MultivariatePolynomials API.

MultivariateBases.maxdegree_basisFunction
maxdegree_basis(basis::StarAlgebras.AbstractBasis, variables, maxdegree::Int)

Return the explicit version of basisgenerating all polynomials of degree up to maxdegree with variables variables.

source
MultivariateBases.explicit_basis_coveringFunction
explicit_basis_covering(basis::StarAlgebras.AbstractBasis, target::StarAlgebras.ExplicitBasis)

Return the minimal basis of type B that can generate all polynomials generated by the basis target.

Examples

For example, to generate all the polynomials with nonzero coefficients for the monomials x^4 and x^2, we need three polynomials as otherwise, we generate polynomials with nonzero constant term.

julia> using DynamicPolynomials

julia> @polyvar x
(x,)

julia> explicit_basis_covering(FullBasis{Chebyshev,typeof(x^2)}(), SubBasis{Monomial}([x^2, x^4]))
SubBasis{ChebyshevFirstKind}([1, x², x⁴])
source

Basis elements

MultivariateBases.PolynomialType
struct Polynomial{B<:AbstractMonomialIndexed,M<:MP.AbstractMonomial}
    monomial::M
    function Polynomial{B}(mono::MP.AbstractMonomial) where {B}
        return new{B,typeof(mono)}(mono)
    end
end

Polynomial of basis FullBasis{B,M}() at index monomial.

source

Monomial basis

MultivariateBases.MonomialType
struct Monomial <: AbstractMonomialIndexed end

Monomial basis with the monomials of the vector monomials. For instance, SubBasis{Monomial}([1, x, y, x^2, x*y, y^2]) is the monomial basis for the subspace of quadratic polynomials in the variables x, y.

This basis is orthogonal under a scalar product defined with the complex Gaussian measure as density. Once normalized so as to be orthonormal with this scalar product, one get ths ScaledMonomial.

source
MultivariateBases.ScaledMonomialType
struct ScaledMonomial <: AbstractMonomial end

Scaled monomial basis (see [Section 3.1.5, BPT12]) with the monomials of the vector monomials. Given a monomial $x^\alpha = x_1^{\alpha_1} \cdots x_n^{\alpha_n}$ of degree $d = \sum_{i=1}^n \alpha_i$, the corresponding polynomial of the basis is

\[{d \choose \alpha}^{\frac{1}{2}} x^{\alpha} \quad \text{ where } \quad {d \choose \alpha} = \frac{d!}{\alpha_1! \alpha_2! \cdots \alpha_n!}.\]

For instance, create a polynomial with the basis $[xy^2, xy]$ creates the polynomial $\sqrt{3} a xy^2 + \sqrt{2} b xy$ where a and b are new JuMP decision variables. Constraining the polynomial $axy^2 + bxy$ to be zero with the scaled monomial basis constrains a/√3 and b/√2 to be zero.

This basis is orthonormal under the scalar product:

\[\langle f, g \rangle = \int_{\mathcal{C}^n} f(z) \overline{g(z)} d\nu_n\]

where $\nu_n$ is the Gaussian measure on $\mathcal{C}^n$ with the density $\pi^{-n} \exp(-\lVert z \rVert^2)$. See [Section 4; B07] for more details.

[BPT12] Blekherman, G.; Parrilo, P. A. & Thomas, R. R. Semidefinite Optimization and Convex Algebraic Geometry. Society for Industrial and Applied Mathematics (2012).

[B07] Barvinok, Alexander. Integration and optimization of multivariate polynomials by restriction onto a random subspace. Foundations of Computational Mathematics 7.2 (2007): 229-244.

source

Orthogonal basis

MultivariateBases.AbstractMultipleOrthogonalType
abstract type AbstractMultipleOrthogonal <: AbstractMonomialIndexed end

Polynomial basis such that $\langle p_i(x), p_j(x) \rangle = 0$ if $i \neq j$ where

\[\langle p(x), q(x) \rangle = \int p(x)q(x) w(x) dx\]

where the weight is a product of weight functions $w(x) = w_1(x_1)w_2(x_2) \cdots w_n(x_n)$ in each variable. The polynomial of the basis are product of univariate polynomials: $p(x) = p_1(x_1)p_2(x_2) \cdots p_n(x_n)$. where the univariate polynomials of variable x_i form an univariate orthogonal basis for the weight function w_i(x_i). Therefore, they satisfy the recurrence relation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

where reccurence_first_coef gives a_k, reccurence_second_coef gives b_k, reccurence_third_coef gives c_k and reccurence_deno_coef gives d_k.

source
MultivariateBases.univariate_orthogonal_basisFunction
univariate_orthogonal_basis(
    B::Type{<:AbstractMultipleOrthogonal},
    variable::MP.AbstractVariable,
    degree::Integer,
)

Return the vector of univariate polynomials of the basis B up to degree with variable variable.

source
MultivariateBases.reccurence_first_coefFunction
reccurence_first_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return a_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.reccurence_second_coefFunction
reccurence_second_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return b_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.reccurence_third_coefFunction
reccurence_third_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return c_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.reccurence_deno_coefFunction
reccurence_deno_coef(B::Type{<:AbstractMultipleOrthogonal}, degree::Integer)

Return d_{degree} in recurrence equation

\[d_k p_k(x_i) = (a_k x_i + b_k) p_{k-1}(x_i) + c_k p_{k-2}(x_i)\]

source
MultivariateBases.ProbabilistsHermiteType
struct ProbabilistsHermiteBasis{P} <: AbstractHermiteBasis{P}
    polynomials::Vector{P}
end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \exp(-x^2/2)$ over the interval $[-\infty, \infty]$.

source
MultivariateBases.PhysicistsHermiteType
struct PhysicistsHermite{P} <: AbstractHermite{P}
    polynomials::Vector{P}
end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \exp(-x^2)$ over the interval $[-\infty, \infty]$.

source
MultivariateBases.LaguerreType
struct LaguerreBasis <: AbstractMultipleOrthogonal end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \exp(-x)$ over the interval $[0, \infty]$.

source
MultivariateBases.AbstractGegenbauerType
struct AbstractGegenbauer <: AbstractMultipleOrthogonal end

Orthogonal polynomial with respect to the univariate weight function $w(x) = (1 - x^2)^{\alpha - 1/2}$ over the interval $[-1, 1]$.

source
MultivariateBases.LegendreType
struct Legendre <: AbstractGegenbauer end

Orthogonal polynomial with respect to the univariate weight function $w(x) = 1$ over the interval $[-1, 1]$.

source
MultivariateBases.ChebyshevFirstKindType
struct ChebyshevFirstKind <: AbstractChebyshev end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \frac{1}{\sqrt{1 - x^2}}$ over the interval $[-1, 1]$.

source
MultivariateBases.ChebyshevSecondKindType
struct ChebyshevSecondKind <: AbstractChebyshevBasis end

Orthogonal polynomial with respect to the univariate weight function $w(x) = \sqrt{1 - x^2}$ over the interval $[-1, 1]$.

source
MultivariateBases.TrigonometricType
struct Trigonometric <: AbstractMonomialIndexed end

Univariate trigonometric basis is

a0 + a1 cos(ωt) + a2 sin(ωt) + a3 cos(2ωt) + a4 sin(2ωt)
source

Additional basis

MultivariateBases.FixedBasisType
struct FixedBasis{B,M,T,V} <:
    SA.ExplicitBasis{SA.AlgebraElement{Algebra{FullBasis{B,M},B,M},T,V},Int}
    elements::Vector{SA.AlgebraElement{Algebra{FullBasis{B,M},B,M},T,V}}
end

Fixed basis with polynomials elements.

source