Integer-valued polynomial rings

AUTHORS:

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

class sage.rings.polynomial.integer_valued_polynomials.IntegerValuedPolynomialRing(R)[source]

Bases: UniqueRepresentation, Parent

The integer-valued polynomial ring over a base ring \(R\).

Integer-valued polynomial rings are commutative and associative algebras, with a basis indexed by nonnegative 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()
>>> from sage.all import *
>>> B = IntegerValuedPolynomialRing(QQ).Binomial()
>>> S = IntegerValuedPolynomialRing(QQ).Shifted()
B = IntegerValuedPolynomialRing(QQ).Binomial()
S = IntegerValuedPolynomialRing(QQ).Shifted()

or by using the shortcuts:

sage: B = IntegerValuedPolynomialRing(QQ).B()
sage: S = IntegerValuedPolynomialRing(QQ).S()
>>> from sage.all import *
>>> B = IntegerValuedPolynomialRing(QQ).B()
>>> S = IntegerValuedPolynomialRing(QQ).S()
B = IntegerValuedPolynomialRing(QQ).B()
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[source]

alias of Binomial

class Bases(parent_with_realization)[source]

Bases: Category_realization_of_parent

class ElementMethods[source]

Bases: object

content()[source]

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[4]+6*B[7]).content()
3
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).S()
>>> B = F.basis()
>>> (Integer(3)*B[Integer(4)]+Integer(6)*B[Integer(7)]).content()
3
F = IntegerValuedPolynomialRing(ZZ).S()
B = F.basis()
(3*B[4]+6*B[7]).content()
polynomial()[source]

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
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).S()
>>> B = F.gen()
>>> (B+Integer(1)).polynomial()
x + 2

>>> F = IntegerValuedPolynomialRing(ZZ).B()
>>> B = F.gen()
>>> (B+Integer(1)).polynomial()
x + 1
F = IntegerValuedPolynomialRing(ZZ).S()
B = F.gen()
(B+1).polynomial()
F = IntegerValuedPolynomialRing(ZZ).B()
B = F.gen()
(B+1).polynomial()
shift(j=1)[source]

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[1] + B[2]
sage: (B+1).shift(3)
B[3] + B[4]
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).B()
>>> B = F.gen()
>>> (B+Integer(1)).shift()
B[1] + B[2]
>>> (B+Integer(1)).shift(Integer(3))
B[3] + B[4]
F = IntegerValuedPolynomialRing(ZZ).B()
B = F.gen()
(B+1).shift()
(B+1).shift(3)
sum_of_coefficients()[source]

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[2]*B[4]).sum_of_coefficients()
1
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).S()
>>> B = F.basis()
>>> (B[Integer(2)]*B[Integer(4)]).sum_of_coefficients()
1
F = IntegerValuedPolynomialRing(ZZ).S()
B = F.basis()
(B[2]*B[4]).sum_of_coefficients()
class ParentMethods[source]

Bases: object

algebra_generators()[source]

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[1],)
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(ZZ).S(); A
Integer-Valued Polynomial Ring over Integer Ring
in the shifted basis
>>> A.algebra_generators()
Family (S[1],)
A = IntegerValuedPolynomialRing(ZZ).S(); A
A.algebra_generators()
degree_on_basis(m)[source]

Return the degree of the basis element indexed by m.

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(QQ).S()
sage: A.degree_on_basis(4)
4
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(QQ).S()
>>> A.degree_on_basis(Integer(4))
4
A = IntegerValuedPolynomialRing(QQ).S()
A.degree_on_basis(4)
from_polynomial(p)[source]

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[5].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[5]
sage: x = polygen(QQ, 'x')
sage: A.from_polynomial(x)
-S[0] + S[1]

sage: A = IntegerValuedPolynomialRing(ZZ).B()
sage: B = A.basis()
sage: B[5].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[5]
sage: x = polygen(QQ, 'x')
sage: A.from_polynomial(x)
B[1]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(ZZ).S()
>>> S = A.basis()
>>> S[Integer(5)].polynomial()
1/120*x^5 + 1/8*x^4 + 17/24*x^3 + 15/8*x^2 + 137/60*x + 1
>>> A.from_polynomial(_)
S[5]
>>> x = polygen(QQ, 'x')
>>> A.from_polynomial(x)
-S[0] + S[1]

>>> A = IntegerValuedPolynomialRing(ZZ).B()
>>> B = A.basis()
>>> B[Integer(5)].polynomial()
1/120*x^5 - 1/12*x^4 + 7/24*x^3 - 5/12*x^2 + 1/5*x
>>> A.from_polynomial(_)
B[5]
>>> x = polygen(QQ, 'x')
>>> A.from_polynomial(x)
B[1]
A = IntegerValuedPolynomialRing(ZZ).S()
S = A.basis()
S[5].polynomial()
A.from_polynomial(_)
x = polygen(QQ, 'x')
A.from_polynomial(x)
A = IntegerValuedPolynomialRing(ZZ).B()
B = A.basis()
B[5].polynomial()
A.from_polynomial(_)
x = polygen(QQ, 'x')
A.from_polynomial(x)
gen(i=0)[source]

Return the generator of this algebra.

The optional argument is ignored.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).B()
sage: F.gen()
B[1]
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).B()
>>> F.gen()
B[1]
F = IntegerValuedPolynomialRing(ZZ).B()
F.gen()
gens()[source]

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[1],)
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(ZZ).S(); A
Integer-Valued Polynomial Ring over Integer Ring
in the shifted basis
>>> A.algebra_generators()
Family (S[1],)
A = IntegerValuedPolynomialRing(ZZ).S(); A
A.algebra_generators()
one_basis()[source]

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[0]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(QQ).S()
>>> A.one_basis()
0
>>> A.one()
S[0]
A = IntegerValuedPolynomialRing(QQ).S()
A.one_basis()
A.one()
super_categories()[source]

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]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(QQ); A
Integer-Valued Polynomial Ring over Rational Field
>>> C = A.Bases(); C
Category of bases of Integer-Valued Polynomial Ring
over Rational Field
>>> 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]
A = IntegerValuedPolynomialRing(QQ); A
C = A.Bases(); C
C.super_categories()
class Binomial(A)[source]

Bases: CombinatorialFreeModule, BindableClass

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[1]

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
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(QQ).B(); F
Integer-Valued Polynomial Ring over Rational Field
in the binomial basis

>>> F.gen()
B[1]

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

>>> 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
>>> G.base_ring()
Integer-Valued Polynomial Ring over Integer Ring
in the binomial basis
F = IntegerValuedPolynomialRing(QQ).B(); F
F.gen()
S = IntegerValuedPolynomialRing(ZZ).B(); S
S.base_ring()
G = IntegerValuedPolynomialRing(S).B(); G
G.base_ring()

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[1]*B[1] + 6*B[1]*B[2] + 6*B[1]*B[3]
sage: parent(s)
Integer-Valued Polynomial Ring over Integer-Valued Polynomial
Ring over Rational Field in the binomial basis in the binomial basis
>>> from sage.all import *
>>> K = IntegerValuedPolynomialRing(QQ).B()
>>> a = K.gen()
>>> K.is_commutative()
True
>>> L = IntegerValuedPolynomialRing(K).B()
>>> c = L.gen()
>>> L.is_commutative()
True
>>> s = a * c**Integer(3); s
B[1]*B[1] + 6*B[1]*B[2] + 6*B[1]*B[3]
>>> parent(s)
Integer-Valued Polynomial Ring over Integer-Valued Polynomial
Ring over Rational Field in the binomial basis in the binomial basis
K = IntegerValuedPolynomialRing(QQ).B()
a = K.gen()
K.is_commutative()
L = IntegerValuedPolynomialRing(K).B()
c = L.gen()
L.is_commutative()
s = a * c^3; s
parent(s)

Integer-valued polynomial rings are commutative:

sage: c^3 * a == c * a * c * c
True
>>> from sage.all import *
>>> c**Integer(3) * a == c * a * c * c
True
c^3 * a == c * a * c * c

We can also manipulate elements in the basis:

sage: F = IntegerValuedPolynomialRing(QQ).B()
sage: B = F.basis()
sage: B[2] * B[3]
3*B[3] + 12*B[4] + 10*B[5]
sage: 1 - B[2] * B[2] / 2
B[0] - 1/2*B[2] - 3*B[3] - 3*B[4]
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(QQ).B()
>>> B = F.basis()
>>> B[Integer(2)] * B[Integer(3)]
3*B[3] + 12*B[4] + 10*B[5]
>>> Integer(1) - B[Integer(2)] * B[Integer(2)] / Integer(2)
B[0] - 1/2*B[2] - 3*B[3] - 3*B[4]
F = IntegerValuedPolynomialRing(QQ).B()
B = F.basis()
B[2] * B[3]
1 - B[2] * B[2] / 2

and coerce elements from our base field:

sage: F(4/3)
4/3*B[0]
>>> from sage.all import *
>>> F(Integer(4)/Integer(3))
4/3*B[0]
F(4/3)
class Element[source]

Bases: IndexedFreeModuleElement

variable_shift(k=1)[source]

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).B()
sage: B = A.basis()
sage: B[5].variable_shift()
B[4] + B[5]
sage: B[5].variable_shift(-1)
-B[0] + B[1] - B[2] + B[3] - B[4] + B[5]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(ZZ).B()
>>> B = A.basis()
>>> B[Integer(5)].variable_shift()
B[4] + B[5]
>>> B[Integer(5)].variable_shift(-Integer(1))
-B[0] + B[1] - B[2] + B[3] - B[4] + B[5]
A = IntegerValuedPolynomialRing(ZZ).B()
B = A.basis()
B[5].variable_shift()
B[5].variable_shift(-1)
product_on_basis(n1, n2)[source]

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[1]
sage: A.product_on_basis(1, 2)
2*B[2] + 3*B[3]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(QQ).B()
>>> A.product_on_basis(Integer(0), Integer(1))
B[1]
>>> A.product_on_basis(Integer(1), Integer(2))
2*B[2] + 3*B[3]
A = IntegerValuedPolynomialRing(QQ).B()
A.product_on_basis(0, 1)
A.product_on_basis(1, 2)
S[source]

alias of Shifted

class Shifted(A)[source]

Bases: CombinatorialFreeModule, BindableClass

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[1]

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
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(QQ).S(); F
Integer-Valued Polynomial Ring over Rational Field
in the shifted basis

>>> F.gen()
S[1]

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

>>> 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
>>> G.base_ring()
Integer-Valued Polynomial Ring over Integer Ring
in the shifted basis
F = IntegerValuedPolynomialRing(QQ).S(); F
F.gen()
S = IntegerValuedPolynomialRing(ZZ).S(); S
S.base_ring()
G = IntegerValuedPolynomialRing(S).S(); G
G.base_ring()

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[1]*S[1] + (-6*S[1])*S[2] + 6*S[1]*S[3]
sage: parent(s)
Integer-Valued Polynomial Ring over Integer-Valued Polynomial
Ring over Rational Field in the shifted basis in the shifted basis
>>> from sage.all import *
>>> K = IntegerValuedPolynomialRing(QQ).S()
>>> a = K.gen()
>>> K.is_commutative()
True
>>> L = IntegerValuedPolynomialRing(K).S()
>>> c = L.gen()
>>> L.is_commutative()
True
>>> s = a * c**Integer(3); s
S[1]*S[1] + (-6*S[1])*S[2] + 6*S[1]*S[3]
>>> parent(s)
Integer-Valued Polynomial Ring over Integer-Valued Polynomial
Ring over Rational Field in the shifted basis in the shifted basis
K = IntegerValuedPolynomialRing(QQ).S()
a = K.gen()
K.is_commutative()
L = IntegerValuedPolynomialRing(K).S()
c = L.gen()
L.is_commutative()
s = a * c^3; s
parent(s)

Integer-valued polynomial rings are commutative:

sage: c^3 * a == c * a * c * c
True
>>> from sage.all import *
>>> c**Integer(3) * a == c * a * c * c
True
c^3 * a == c * a * c * c

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[2] * S[3]
3*S[3] - 12*S[4] + 10*S[5]
sage: 1 - S[2] * S[2] / 2
S[0] - 1/2*S[2] + 3*S[3] - 3*S[4]
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(QQ).S()
>>> S = F.basis()
>>> S[Integer(2)] * S[Integer(3)]
3*S[3] - 12*S[4] + 10*S[5]
>>> Integer(1) - S[Integer(2)] * S[Integer(2)] / Integer(2)
S[0] - 1/2*S[2] + 3*S[3] - 3*S[4]
F = IntegerValuedPolynomialRing(QQ).S()
S = F.basis()
S[2] * S[3]
1 - S[2] * S[2] / 2
class Element[source]

Bases: IndexedFreeModuleElement

delta()[source]

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[5].delta()
S[0] + S[1] + S[2] + S[3] + S[4]
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).S()
>>> S = F.basis()
>>> S[Integer(5)].delta()
S[0] + S[1] + S[2] + S[3] + S[4]
F = IntegerValuedPolynomialRing(ZZ).S()
S = F.basis()
S[5].delta()
derivative_at_minus_one()[source]

Return the derivative at \(-1\).

This is sometimes useful when \(-1\) is a root.

See also

umbra()

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: B = F.gen()
sage: (B+1).derivative_at_minus_one()
1
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).S()
>>> B = F.gen()
>>> (B+Integer(1)).derivative_at_minus_one()
1
F = IntegerValuedPolynomialRing(ZZ).S()
B = F.gen()
(B+1).derivative_at_minus_one()
fraction()[source]

Return the generating series of values as a fraction.

In the case of Ehrhart polynomials, this is known as the Ehrhart series.

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(ZZ).S()
sage: ex = A.monomial(4)
sage: f = ex.fraction();f
1/(-t^5 + 5*t^4 - 10*t^3 + 10*t^2 - 5*t + 1)

sage: F = LazyPowerSeriesRing(QQ, 't')
sage: F(f)
1 + 5*t + 15*t^2 + 35*t^3 + 70*t^4 + 126*t^5 + 210*t^6 + O(t^7)

sage: poly = ex.polynomial()
sage: [poly(i) for i in range(6)]
[1, 5, 15, 35, 70, 126]

sage: y = polygen(QQ, 'y')
sage: penta = A.from_polynomial(7/2*y^2 + 7/2*y + 1)
sage: penta.fraction()
(t^2 + 5*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(ZZ).S()
>>> ex = A.monomial(Integer(4))
>>> f = ex.fraction();f
1/(-t^5 + 5*t^4 - 10*t^3 + 10*t^2 - 5*t + 1)

>>> F = LazyPowerSeriesRing(QQ, 't')
>>> F(f)
1 + 5*t + 15*t^2 + 35*t^3 + 70*t^4 + 126*t^5 + 210*t^6 + O(t^7)

>>> poly = ex.polynomial()
>>> [poly(i) for i in range(Integer(6))]
[1, 5, 15, 35, 70, 126]

>>> y = polygen(QQ, 'y')
>>> penta = A.from_polynomial(Integer(7)/Integer(2)*y**Integer(2) + Integer(7)/Integer(2)*y + Integer(1))
>>> penta.fraction()
(t^2 + 5*t + 1)/(-t^3 + 3*t^2 - 3*t + 1)
A = IntegerValuedPolynomialRing(ZZ).S()
ex = A.monomial(4)
f = ex.fraction();f
F = LazyPowerSeriesRing(QQ, 't')
F(f)
poly = ex.polynomial()
[poly(i) for i in range(6)]
y = polygen(QQ, 'y')
penta = A.from_polynomial(7/2*y^2 + 7/2*y + 1)
penta.fraction()
h_polynomial()[source]

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^2 + 4*z + 1
>>> from sage.all import *
>>> x = polygen(QQ,'x')
>>> A = IntegerValuedPolynomialRing(ZZ).S()
>>> ex = A.from_polynomial((Integer(1)+x)**Integer(3))
>>> ex.h_polynomial()
z^2 + 4*z + 1
x = polygen(QQ,'x')
A = IntegerValuedPolynomialRing(ZZ).S()
ex = A.from_polynomial((1+x)**3)
ex.h_polynomial()
h_vector()[source]

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)
>>> from sage.all import *
>>> x = polygen(QQ,'x')
>>> A = IntegerValuedPolynomialRing(ZZ).S()
>>> ex = A.from_polynomial((Integer(1)+x)**Integer(3))
>>> ex.h_vector()
(0, 1, 4, 1)
x = polygen(QQ,'x')
A = IntegerValuedPolynomialRing(ZZ).S()
ex = A.from_polynomial((1+x)**3)
ex.h_vector()
umbra()[source]

Return the Bernoulli umbra.

This is the derivative at \(-1\) of the shift by one.

This is related to Bernoulli numbers.

EXAMPLES:

sage: F = IntegerValuedPolynomialRing(ZZ).S()
sage: B = F.gen()
sage: (B+1).umbra()
3/2
>>> from sage.all import *
>>> F = IntegerValuedPolynomialRing(ZZ).S()
>>> B = F.gen()
>>> (B+Integer(1)).umbra()
3/2
F = IntegerValuedPolynomialRing(ZZ).S()
B = F.gen()
(B+1).umbra()
variable_shift(k=1)[source]

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[5].variable_shift()
S[0] + S[1] + S[2] + S[3] + S[4] + S[5]

sage: S[5].variable_shift(-1)
-S[4] + S[5]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(ZZ).S()
>>> S = A.basis()
>>> S[Integer(5)].variable_shift()
S[0] + S[1] + S[2] + S[3] + S[4] + S[5]

>>> S[Integer(5)].variable_shift(-Integer(1))
-S[4] + S[5]
A = IntegerValuedPolynomialRing(ZZ).S()
S = A.basis()
S[5].variable_shift()
S[5].variable_shift(-1)
from_h_vector(h)[source]

Convert from some \(h\)-vector.

INPUT:

  • h – tuple or vector

EXAMPLES:

sage: A = IntegerValuedPolynomialRing(ZZ).S()
sage: S = A.basis()
sage: ex = S[2]+S[4]
sage: A.from_h_vector(ex.h_vector())
S[2] + S[4]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(ZZ).S()
>>> S = A.basis()
>>> ex = S[Integer(2)]+S[Integer(4)]
>>> A.from_h_vector(ex.h_vector())
S[2] + S[4]
A = IntegerValuedPolynomialRing(ZZ).S()
S = A.basis()
ex = S[2]+S[4]
A.from_h_vector(ex.h_vector())
product_on_basis(n1, n2)[source]

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[1]
sage: A.product_on_basis(1, 2)
-2*S[2] + 3*S[3]
>>> from sage.all import *
>>> A = IntegerValuedPolynomialRing(QQ).S()
>>> A.product_on_basis(Integer(0), Integer(1))
S[1]
>>> A.product_on_basis(Integer(1), Integer(2))
-2*S[2] + 3*S[3]
A = IntegerValuedPolynomialRing(QQ).S()
A.product_on_basis(0, 1)
A.product_on_basis(1, 2)
a_realization()[source]

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
>>> from sage.all import *
>>> IntegerValuedPolynomialRing(QQ).a_realization()
Integer-Valued Polynomial Ring over Rational Field
in the binomial basis
IntegerValuedPolynomialRing(QQ).a_realization()