# Integer-valued polynomial rings#

AUTHORS:

• Frédéric Chapoton (2023-03): Initial version

class sage.rings.polynomial.integer_valued_polynomials.IntegerValuedPolynomialRing(R)#

The integer-valued polynomial ring over a base ring $$R$$.

Integer-valued polynomial rings are commutative and associative algebras, with a basis indexed by non-negative integers.

There are two natural bases, made of the sequence $$\binom{x}{n}$$ for $$n \geq 0$$ (the binomial basis) and of the other sequence $$\binom{x+n}{n}$$ for $$n \geq 0$$ (the shifted basis).

These two bases are available as follows:

sage: B = IntegerValuedPolynomialRing(QQ).Binomial()
sage: S = IntegerValuedPolynomialRing(QQ).Shifted()


or by using the shortcuts:

sage: B = IntegerValuedPolynomialRing(QQ).B()
sage: S = IntegerValuedPolynomialRing(QQ).S()


There is a conversion formula between the two bases:

$\binom{x}{i} = \sum_{k=0}^{i} (-1)^{i-k} \binom{i}{k} \binom{x+k}{k}$

with inverse:

$\binom{x+i}{i} = \sum_{k=0}^{i} \binom{i}{k} \binom{x}{k}.$

REFERENCES:

B#

alias of Binomial

class Bases(parent_with_realization)#
class ElementMethods#

Bases: object

content()#

Return the content of self.

This is the gcd of the coefficients.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: B = F.basis()
sage: (3*B+6*B).content()
3

polynomial()#

Convert to a polynomial in $$x$$.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: B = F.gen()
sage: (B+1).polynomial()
x + 2

sage: F = IntegerValuedPolynomialRing(ZZ).B()
sage: B = F.gen()
sage: (B+1).polynomial()
x + 1

shift(j=1)#

Shift all indices by $$j$$.

INPUT:

• $$j$$ – integer (default: 1)

In the binomial basis, the shift by 1 corresponds to a summation operator from $$0$$ to $$x$$.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).B()
sage: B = F.gen()
sage: (B+1).shift()
B + B
sage: (B+1).shift(3)
B + B

sum_of_coefficients()#

Return the sum of coefficients.

In the shifted basis, this is the evaluation at $$x=0$$.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: B = F.basis()
sage: (B*B).sum_of_coefficients()
1

class ParentMethods#

Bases: object

algebra_generators()#

Return the generators of this algebra.

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(ZZ).S(); A
Integer-Valued Polynomial Ring over Integer Ring
in the shifted basis
sage: A.algebra_generators()
Family (S,)

degree_on_basis(m)#

Return the degree of the basis element indexed by m.

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(QQ).S()
sage: A.degree_on_basis(4)
4

from_polynomial(p)#

Convert a polynomial into the ring of integer-valued polynomials.

This raises a ValueError if this is not possible.

INPUT:

• p – a polynomial in one variable

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(ZZ).S()
sage: S = A.basis()
sage: S.polynomial()
1/120*x^5 + 1/8*x^4 + 17/24*x^3 + 15/8*x^2 + 137/60*x + 1
sage: A.from_polynomial(_)
S
sage: x = polygen(QQ, 'x')
sage: A.from_polynomial(x)
-S + S

sage: A = IntegerValuedPolynomialRing(ZZ).B()
sage: B = A.basis()
sage: B.polynomial()
1/120*x^5 - 1/12*x^4 + 7/24*x^3 - 5/12*x^2 + 1/5*x
sage: A.from_polynomial(_)
B
sage: x = polygen(QQ, 'x')
sage: A.from_polynomial(x)
B

gen(i=0)#

Return the generator of this algebra.

The optional argument is ignored.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).B()
sage: F.gen()
B

gens()#

Return the generators of this algebra.

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(ZZ).S(); A
Integer-Valued Polynomial Ring over Integer Ring
in the shifted basis
sage: A.algebra_generators()
Family (S,)

one_basis()#

Return the number 0, which index the unit of this algebra.

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(QQ).S()
sage: A.one_basis()
0
sage: A.one()
S

super_categories()#

Return the super-categories of self.

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(QQ); A
Integer-Valued Polynomial Ring over Rational Field
sage: C = A.Bases(); C
Category of bases of Integer-Valued Polynomial Ring
over Rational Field
sage: C.super_categories()
[Category of realizations of Integer-Valued Polynomial Ring
over Rational Field,
Join of Category of algebras with basis over Rational Field and
Category of filtered algebras over Rational Field and
Category of commutative algebras over Rational Field and
Category of realizations of unital magmas]

class Binomial(A)#

The integer-valued polynomial ring in the binomial basis.

The basis used here is given by $$B[i] = \binom{x}{i}$$ for $$i \in \NN$$.

Assuming $$n_1 \leq n_2$$, the product of two monomials $$B[n_1] \cdot B[n_2]$$ is given by the sum

$\sum_{k=0}^{n_1} \binom{n_1}{k}\binom{n_1+n_2-k}{n_1} B[n_1 + n_2 - k].$

The product of two monomials is therefore a positive linear combination of monomials.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(QQ).B(); F
Integer-Valued Polynomial Ring over Rational Field
in the binomial basis

sage: F.gen()
B

sage: S = IntegerValuedPolynomialRing(ZZ).B(); S
Integer-Valued Polynomial Ring over Integer Ring
in the binomial basis
sage: S.base_ring()
Integer Ring

sage: G = IntegerValuedPolynomialRing(S).B(); G
Integer-Valued Polynomial Ring over Integer-Valued Polynomial Ring
over Integer Ring in the binomial basis in the binomial basis
sage: G.base_ring()
Integer-Valued Polynomial Ring over Integer Ring
in the binomial basis


Integer-valued polynomial rings commute with their base ring:

sage: K = IntegerValuedPolynomialRing(QQ).B()
sage: a = K.gen()
sage: K.is_commutative()
True
sage: L = IntegerValuedPolynomialRing(K).B()
sage: c = L.gen()
sage: L.is_commutative()
True
sage: s = a * c^3; s
B*B + 6*B*B + 6*B*B
sage: parent(s)
Integer-Valued Polynomial Ring over Integer-Valued Polynomial
Ring over Rational Field in the binomial basis in the binomial basis


Integer-valued polynomial rings are commutative:

sage: c^3 * a == c * a * c * c
True


We can also manipulate elements in the basis:

sage: F = IntegerValuedPolynomialRing(QQ).B()
sage: B = F.basis()
sage: B * B
3*B + 12*B + 10*B
sage: 1 - B * B / 2
B - 1/2*B - 3*B - 3*B


and coerce elements from our base field:

sage: F(4/3)
4/3*B

class Element#
product_on_basis(n1, n2)#

Return the product of basis elements n1 and n2.

INPUT:

• n1, n2 – integers

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(QQ).B()
sage: A.product_on_basis(0, 1)
B
sage: A.product_on_basis(1, 2)
2*B + 3*B

S#

alias of Shifted

class Shifted(A)#

The integer-valued polynomial ring in the shifted basis.

The basis used here is given by $$S[i] = \binom{i+x}{i}$$ for $$i \in \NN$$.

Assuming $$n_1 \leq n_2$$, the product of two monomials $$S[n_1] \cdot S[n_2]$$ is given by the sum

$\sum_{k=0}^{n_1} (-1)^k \binom{n_1}{k}\binom{n_1+n_2-k}{n_1} S[n_1 + n_2 - k].$

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(QQ).S(); F
Integer-Valued Polynomial Ring over Rational Field
in the shifted basis

sage: F.gen()
S

sage: S = IntegerValuedPolynomialRing(ZZ).S(); S
Integer-Valued Polynomial Ring over Integer Ring
in the shifted basis
sage: S.base_ring()
Integer Ring

sage: G = IntegerValuedPolynomialRing(S).S(); G
Integer-Valued Polynomial Ring over Integer-Valued Polynomial
Ring over Integer Ring in the shifted basis in the shifted basis
sage: G.base_ring()
Integer-Valued Polynomial Ring over Integer Ring
in the shifted basis


Integer-valued polynomial rings commute with their base ring:

sage: K = IntegerValuedPolynomialRing(QQ).S()
sage: a = K.gen()
sage: K.is_commutative()
True
sage: L = IntegerValuedPolynomialRing(K).S()
sage: c = L.gen()
sage: L.is_commutative()
True
sage: s = a * c^3; s
S*S + (-6*S)*S + 6*S*S
sage: parent(s)
Integer-Valued Polynomial Ring over Integer-Valued Polynomial
Ring over Rational Field in the shifted basis in the shifted basis


Integer-valued polynomial rings are commutative:

sage: c^3 * a == c * a * c * c
True


We can also manipulate elements in the basis and coerce elements from our base field:

sage: F = IntegerValuedPolynomialRing(QQ).S()
sage: S = F.basis()
sage: S * S
3*S - 12*S + 10*S
sage: 1 - S * S / 2
S - 1/2*S + 3*S - 3*S

class Element#
delta()#

Return the image by the difference operator $$\Delta$$.

The operator $$\Delta$$ is defined on polynomials by

$f \mapsto f(x+1)-f(x).$

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: S = F.basis()
sage: S.delta()
S + S + S + S + S

derivative_at_minus_one()#

Return the derivative at $$-1$$.

This is sometimes useful when $$-1$$ is a root.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: B = F.gen()
sage: (B+1).derivative_at_minus_one()
1

h_polynomial()#

Return the $$h$$-vector as a polynomial.

EXAMPLES:

sage: x = polygen(QQ,'x')
sage: A = IntegerValuedPolynomialRing(ZZ).S()
sage: ex = A.from_polynomial((1+x)**3)
sage: ex.h_polynomial()
z^3 + 4*z^2 + z

h_vector()#

Return the numerator of the generating series of values.

If self is an Ehrhart polynomial, this is the $$h$$-vector.

EXAMPLES:

sage: x = polygen(QQ,'x')
sage: A = IntegerValuedPolynomialRing(ZZ).S()
sage: ex = A.from_polynomial((1+x)**3)
sage: ex.h_vector()
(0, 1, 4, 1)

umbra()#

Return the Bernoulli umbra.

This is the derivative at $$-1$$ of the shift by one.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: B = F.gen()
sage: (B+1).umbra()
3/2

variable_shift(k=1)#

Return the image by the shift of variables.

On polynomials, the action is the shift on variables $$x \mapsto x + k$$.

INPUT:

• $$k$$ – integer (default: 1)

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(ZZ).S()
sage: S = A.basis()
sage: S.variable_shift()
S + S + S + S + S + S

sage: S.variable_shift(-1)
-S + S

from_h_vector(h)#

Convert from some $$h$$-vector.

INPUT:

• h – a tuple or vector

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(ZZ).S()
sage: S = A.basis()
sage: ex = S+S
sage: A.from_h_vector(ex.h_vector())
S + S

product_on_basis(n1, n2)#

Return the product of basis elements n1 and n2.

INPUT:

• n1, n2 – integers

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(QQ).S()
sage: A.product_on_basis(0, 1)
S
sage: A.product_on_basis(1, 2)
-2*S + 3*S

a_realization()#

Return a default realization.

The Binomial realization is chosen.

EXAMPLES:

sage: IntegerValuedPolynomialRing(QQ).a_realization()
Integer-Valued Polynomial Ring over Rational Field
in the binomial basis