Ring of Laurent Polynomials#
If \(R\) is a commutative ring, then the ring of Laurent polynomials in \(n\) variables over \(R\) is \(R[x_1^{\pm 1}, x_2^{\pm 1}, \ldots, x_n^{\pm 1}]\). We implement it as a quotient ring
AUTHORS:
David Roe (2008-2-23): created
David Loeffler (2009-07-10): cleaned up docstrings
- sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing(base_ring, *args, **kwds)#
Return the globally unique univariate or multivariate Laurent polynomial ring with given properties and variable name or names.
There are four ways to call the Laurent polynomial ring constructor:
LaurentPolynomialRing(base_ring, name, sparse=False)
LaurentPolynomialRing(base_ring, names, order='degrevlex')
LaurentPolynomialRing(base_ring, name, n, order='degrevlex')
LaurentPolynomialRing(base_ring, n, name, order='degrevlex')
The optional arguments sparse and order must be explicitly named, and the other arguments must be given positionally.
INPUT:
base_ring
– a commutative ringname
– a stringnames
– a list or tuple of names, or a comma separated stringn
– a positive integersparse
– bool (default: False), whether or not elements are sparseorder
– string orTermOrder
, e.g.,'degrevlex'
(default) – degree reverse lexicographic'lex'
– lexicographic'deglex'
– degree lexicographicTermOrder('deglex',3) + TermOrder('deglex',3)
– block ordering
OUTPUT:
LaurentPolynomialRing(base_ring, name, sparse=False)
returns a univariate Laurent polynomial ring; all other input formats return a multivariate Laurent polynomial ring.UNIQUENESS and IMMUTABILITY: In Sage there is exactly one single-variate Laurent polynomial ring over each base ring in each choice of variable and sparseness. There is also exactly one multivariate Laurent polynomial ring over each base ring for each choice of names of variables and term order.
sage: R.<x,y> = LaurentPolynomialRing(QQ,2); R Multivariate Laurent Polynomial Ring in x, y over Rational Field sage: f = x^2 - 2*y^-2
You can’t just globally change the names of those variables. This is because objects all over Sage could have pointers to that polynomial ring.
sage: R._assign_names(['z','w']) Traceback (most recent call last): ... ValueError: variable names cannot be changed after object creation.
EXAMPLES:
LaurentPolynomialRing(base_ring, name, sparse=False)
sage: LaurentPolynomialRing(QQ, 'w') Univariate Laurent Polynomial Ring in w over Rational Field
Use the diamond brackets notation to make the variable ready for use after you define the ring:
sage: R.<w> = LaurentPolynomialRing(QQ) sage: (1 + w)^3 1 + 3*w + 3*w^2 + w^3
You must specify a name:
sage: LaurentPolynomialRing(QQ) Traceback (most recent call last): ... TypeError: you must specify the names of the variables sage: R.<abc> = LaurentPolynomialRing(QQ, sparse=True); R Univariate Laurent Polynomial Ring in abc over Rational Field sage: R.<w> = LaurentPolynomialRing(PolynomialRing(GF(7),'k')); R Univariate Laurent Polynomial Ring in w over Univariate Polynomial Ring in k over Finite Field of size 7
Rings with different variables are different:
sage: LaurentPolynomialRing(QQ, 'x') == LaurentPolynomialRing(QQ, 'y') False
LaurentPolynomialRing(base_ring, names, order='degrevlex')
sage: R = LaurentPolynomialRing(QQ, 'a,b,c'); R Multivariate Laurent Polynomial Ring in a, b, c over Rational Field sage: S = LaurentPolynomialRing(QQ, ['a','b','c']); S Multivariate Laurent Polynomial Ring in a, b, c over Rational Field sage: T = LaurentPolynomialRing(QQ, ('a','b','c')); T Multivariate Laurent Polynomial Ring in a, b, c over Rational Field
All three rings are identical.
sage: (R is S) and (S is T) True
There is a unique Laurent polynomial ring with each term order:
sage: R = LaurentPolynomialRing(QQ, 'x,y,z', order='degrevlex'); R Multivariate Laurent Polynomial Ring in x, y, z over Rational Field sage: S = LaurentPolynomialRing(QQ, 'x,y,z', order='invlex'); S Multivariate Laurent Polynomial Ring in x, y, z over Rational Field sage: S is LaurentPolynomialRing(QQ, 'x,y,z', order='invlex') True sage: R == S False
LaurentPolynomialRing(base_ring, name, n, order='degrevlex')
If you specify a single name as a string and a number of variables, then variables labeled with numbers are created.
sage: LaurentPolynomialRing(QQ, 'x', 10) Multivariate Laurent Polynomial Ring in x0, x1, x2, x3, x4, x5, x6, x7, x8, x9 over Rational Field sage: LaurentPolynomialRing(GF(7), 'y', 5) Multivariate Laurent Polynomial Ring in y0, y1, y2, y3, y4 over Finite Field of size 7 sage: LaurentPolynomialRing(QQ, 'y', 3, sparse=True) Multivariate Laurent Polynomial Ring in y0, y1, y2 over Rational Field
By calling the
inject_variables()
method, all those variable names are available for interactive use:sage: R = LaurentPolynomialRing(GF(7),15,'w'); R Multivariate Laurent Polynomial Ring in w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14 over Finite Field of size 7 sage: R.inject_variables() Defining w0, w1, w2, w3, w4, w5, w6, w7, w8, w9, w10, w11, w12, w13, w14 sage: (w0 + 2*w8 + w13)^2 w0^2 + 4*w0*w8 + 4*w8^2 + 2*w0*w13 + 4*w8*w13 + w13^2
- class sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_generic(R)#
Bases:
CommutativeRing
,Parent
Laurent polynomial ring (base class).
EXAMPLES:
This base class inherits from
CommutativeRing
. Since trac ticket #11900, it is also initialised as such:sage: R.<x1,x2> = LaurentPolynomialRing(QQ) sage: R.category() Join of Category of unique factorization domains and Category of commutative algebras over (number fields and quotient fields and metric spaces) and Category of infinite sets sage: TestSuite(R).run()
- change_ring(base_ring=None, names=None, sparse=False, order=None)#
EXAMPLES:
sage: R = LaurentPolynomialRing(QQ,2,'x') sage: R.change_ring(ZZ) Multivariate Laurent Polynomial Ring in x0, x1 over Integer Ring
Check that the distinction between a univariate ring and a multivariate ring with one generator is preserved:
sage: P.<x> = LaurentPolynomialRing(QQ, 1) sage: P Multivariate Laurent Polynomial Ring in x over Rational Field sage: K.<i> = CyclotomicField(4) sage: P.change_ring(K) Multivariate Laurent Polynomial Ring in x over Cyclotomic Field of order 4 and degree 2
- characteristic()#
Returns the characteristic of the base ring.
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').characteristic() 0 sage: LaurentPolynomialRing(GF(3),2,'x').characteristic() 3
- completion(p, prec=20, extras=None)#
EXAMPLES:
sage: P.<x>=LaurentPolynomialRing(QQ) sage: P Univariate Laurent Polynomial Ring in x over Rational Field sage: PP=P.completion(x) sage: PP Laurent Series Ring in x over Rational Field sage: f=1-1/x sage: PP(f) -x^-1 + 1 sage: 1/PP(f) -x - x^2 - x^3 - x^4 - x^5 - x^6 - x^7 - x^8 - x^9 - x^10 - x^11 - x^12 - x^13 - x^14 - x^15 - x^16 - x^17 - x^18 - x^19 - x^20 + O(x^21)
- construction()#
Return the construction of
self
.EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x,y').construction() (LaurentPolynomialFunctor, Univariate Laurent Polynomial Ring in x over Rational Field)
- fraction_field()#
The fraction field is the same as the fraction field of the polynomial ring.
EXAMPLES:
sage: L.<x> = LaurentPolynomialRing(QQ) sage: L.fraction_field() Fraction Field of Univariate Polynomial Ring in x over Rational Field sage: (x^-1 + 2) / (x - 1) (2*x + 1)/(x^2 - x)
- gen(i=0)#
Returns the \(i^{th}\) generator of self. If i is not specified, then the first generator will be returned.
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').gen() x0 sage: LaurentPolynomialRing(QQ,2,'x').gen(0) x0 sage: LaurentPolynomialRing(QQ,2,'x').gen(1) x1
- ideal(*args, **kwds)#
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').ideal([1]) Ideal (1) of Multivariate Laurent Polynomial Ring in x0, x1 over Rational Field
- is_exact()#
Returns True if the base ring is exact.
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').is_exact() True sage: LaurentPolynomialRing(RDF,2,'x').is_exact() False
- is_field(proof=True)#
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').is_field() False
- is_finite()#
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').is_finite() False
- is_integral_domain(proof=True)#
Returns True if self is an integral domain.
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').is_integral_domain() True
The following used to fail; see trac ticket #7530:
sage: L = LaurentPolynomialRing(ZZ, 'X') sage: L['Y'] Univariate Polynomial Ring in Y over Univariate Laurent Polynomial Ring in X over Integer Ring
- is_noetherian()#
Returns True if self is Noetherian.
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').is_noetherian() Traceback (most recent call last): ... NotImplementedError
- krull_dimension()#
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').krull_dimension() Traceback (most recent call last): ... NotImplementedError
- ngens()#
Return the number of generators of
self
.EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').ngens() 2 sage: LaurentPolynomialRing(QQ,1,'x').ngens() 1
- polynomial_ring()#
Returns the polynomial ring associated with self.
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').polynomial_ring() Multivariate Polynomial Ring in x0, x1 over Rational Field sage: LaurentPolynomialRing(QQ,1,'x').polynomial_ring() Multivariate Polynomial Ring in x over Rational Field
- random_element(low_degree=-2, high_degree=2, terms=5, choose_degree=False, *args, **kwds)#
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').random_element() Traceback (most recent call last): ... NotImplementedError
- remove_var(var)#
EXAMPLES:
sage: R = LaurentPolynomialRing(QQ,'x,y,z') sage: R.remove_var('x') Multivariate Laurent Polynomial Ring in y, z over Rational Field sage: R.remove_var('x').remove_var('y') Univariate Laurent Polynomial Ring in z over Rational Field
- term_order()#
Returns the term order of self.
EXAMPLES:
sage: LaurentPolynomialRing(QQ,2,'x').term_order() Degree reverse lexicographic term order
- variable_names_recursive(depth=+Infinity)#
Return the list of variable names of this ring and its base rings, as if it were a single multi-variate Laurent polynomial.
INPUT:
depth
– an integer orInfinity
.
OUTPUT:
A tuple of strings.
EXAMPLES:
sage: T = LaurentPolynomialRing(QQ, 'x') sage: S = LaurentPolynomialRing(T, 'y') sage: R = LaurentPolynomialRing(S, 'z') sage: R.variable_names_recursive() ('x', 'y', 'z') sage: R.variable_names_recursive(2) ('y', 'z')
- class sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_mpair(R)#
Bases:
LaurentPolynomialRing_generic
EXAMPLES:
sage: L = LaurentPolynomialRing(QQ,2,'x') sage: type(L) <class 'sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_mpair_with_category'> sage: L == loads(dumps(L)) True
- Element#
alias of
LaurentPolynomial_mpair
- monomial(*args)#
Return the monomial whose exponents are given in argument.
EXAMPLES:
sage: L = LaurentPolynomialRing(QQ, 'x', 2) sage: L.monomial(-3, 5) x0^-3*x1^5 sage: L.monomial(1, 1) x0*x1 sage: L.monomial(0, 0) 1 sage: L.monomial(-2, -3) x0^-2*x1^-3 sage: x0, x1 = L.gens() sage: L.monomial(-1, 2) == x0^-1 * x1^2 True sage: L.monomial(1, 2, 3) Traceback (most recent call last): ... TypeError: tuple key must have same length as ngens
- class sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_univariate(R)#
Bases:
LaurentPolynomialRing_generic
EXAMPLES:
sage: L = LaurentPolynomialRing(QQ,'x') sage: type(L) <class 'sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_univariate_with_category'> sage: L == loads(dumps(L)) True
- Element#
alias of
LaurentPolynomial_univariate
- sage.rings.polynomial.laurent_polynomial_ring.from_fraction_field(L, x)#
Helper function to construct a Laurent polynomial from an element of its parent’s fraction field.
INPUT:
L
– an instance ofLaurentPolynomialRing_generic
x
– an element of the fraction field ofL
OUTPUT:
An instance of the element class of
L
. If the denominator fails to be a unit inL
an error is raised.EXAMPLES:
sage: from sage.rings.polynomial.laurent_polynomial_ring import from_fraction_field sage: L.<x, y> = LaurentPolynomialRing(ZZ) sage: F = L.fraction_field() sage: xi = F(~x) sage: from_fraction_field(L, xi) == ~x True
- sage.rings.polynomial.laurent_polynomial_ring.is_LaurentPolynomialRing(R)#
Returns True if and only if R is a Laurent polynomial ring.
EXAMPLES:
sage: from sage.rings.polynomial.laurent_polynomial_ring import is_LaurentPolynomialRing sage: P = PolynomialRing(QQ,2,'x') sage: is_LaurentPolynomialRing(P) False sage: R = LaurentPolynomialRing(QQ,3,'x') sage: is_LaurentPolynomialRing(R) True