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,ParentThe integer-valued polynomial ring over a base ring
.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
for (the binomial basis) and of the other sequence for (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:
with inverse:
REFERENCES:
- 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
- polynomial()[source]¶
Convert to a polynomial in
.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
- 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],)
- 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_polynomial(p)[source]¶
Convert a polynomial into the ring of integer-valued polynomials.
This raises a
ValueErrorif 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]
- 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]
- gens()[source]¶
alias of
algebra_generators().
- 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]
- class Binomial(A)[source]¶
Bases:
CombinatorialFreeModule,BindableClassThe integer-valued polynomial ring in the binomial basis.
The basis used here is given by
for .Assuming
, the product of two monomials is given by the sumThe 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
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
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[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]
and coerce elements from our base field:
sage: F(4/3) 4/3*B[0]
- 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
.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]
- class Shifted(A)[source]¶
Bases:
CombinatorialFreeModule,BindableClassThe integer-valued polynomial ring in the shifted basis.
The basis used here is given by
for .Assuming
, the product of two monomials is given by the sumEXAMPLES:
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
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
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[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]
- class Element[source]¶
Bases:
IndexedFreeModuleElement- delta()[source]¶
Return the image by the difference operator
.The operator
is defined on polynomials byEXAMPLES:
sage: F = IntegerValuedPolynomialRing(ZZ).S() sage: S = F.basis() sage: S[5].delta() S[0] + S[1] + S[2] + S[3] + S[4]
- derivative_at_minus_one()[source]¶
Return the derivative at
.This is sometimes useful when
is a root.See also
EXAMPLES:
sage: F = IntegerValuedPolynomialRing(ZZ).S() sage: B = F.gen() sage: (B+1).derivative_at_minus_one() 1
- fraction()[source]¶
Return the generating series of values as a fraction.
In the case of Ehrhart polynomials, this is known as the Ehrhart series.
See also
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)
- h_polynomial()[source]¶
Return the
-vector as a polynomial.See also
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
- h_vector()[source]¶
Return the numerator of the generating series of values.
If
selfis an Ehrhart polynomial, this is the -vector.See also
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()[source]¶
Return the Bernoulli umbra.
This is the derivative at
of the shift by one.This is related to Bernoulli numbers.
See also
EXAMPLES:
sage: F = IntegerValuedPolynomialRing(ZZ).S() sage: B = F.gen() sage: (B+1).umbra() 3/2
- variable_shift(k=1)[source]¶
Return the image by the shift of variables.
On polynomials, the action is the shift on variables
.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]