Ring of Laurent Polynomials (base class)¶
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}]\).
AUTHORS:
David Roe (2008-2-23): created
David Loeffler (2009-07-10): cleaned up docstrings
- class sage.rings.polynomial.laurent_polynomial_ring_base.LaurentPolynomialRing_generic(R)[source]¶
Bases:
CommutativeRing
,Parent
Laurent polynomial ring (base class).
EXAMPLES:
This base class inherits from
CommutativeRing
. Since Issue #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 algebras with basis over (number fields and quotient fields and metric spaces) and Category of commutative algebras over (number fields and quotient fields and metric spaces) and Category of infinite sets sage: TestSuite(R).run()
>>> from sage.all import * >>> R = LaurentPolynomialRing(QQ, names=('x1', 'x2',)); (x1, x2,) = R._first_ngens(2) >>> R.category() Join of Category of unique factorization domains and Category of algebras with basis over (number fields and quotient fields and metric spaces) and Category of commutative algebras over (number fields and quotient fields and metric spaces) and Category of infinite sets >>> TestSuite(R).run()
- change_ring(base_ring=None, names=None, sparse=False, order=None)[source]¶
EXAMPLES:
sage: R = LaurentPolynomialRing(QQ, 2, 'x') sage: R.change_ring(ZZ) Multivariate Laurent Polynomial Ring in x0, x1 over Integer Ring
>>> from sage.all import * >>> R = LaurentPolynomialRing(QQ, Integer(2), 'x') >>> 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) # needs sage.rings.number_field sage: P.change_ring(K) # needs sage.rings.number_field Multivariate Laurent Polynomial Ring in x over Cyclotomic Field of order 4 and degree 2
>>> from sage.all import * >>> P = LaurentPolynomialRing(QQ, Integer(1), names=('x',)); (x,) = P._first_ngens(1) >>> P Multivariate Laurent Polynomial Ring in x over Rational Field >>> K = CyclotomicField(Integer(4), names=('i',)); (i,) = K._first_ngens(1)# needs sage.rings.number_field >>> P.change_ring(K) # needs sage.rings.number_field Multivariate Laurent Polynomial Ring in x over Cyclotomic Field of order 4 and degree 2
- characteristic()[source]¶
Return the characteristic of the base ring.
EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').characteristic() 0 sage: LaurentPolynomialRing(GF(3), 2, 'x').characteristic() 3
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').characteristic() 0 >>> LaurentPolynomialRing(GF(Integer(3)), Integer(2), 'x').characteristic() 3
- completion(p=None, prec=20, extras=None)[source]¶
Return the completion of
self
.Currently only implemented for the ring of formal Laurent series. The
prec
variable controls the precision used in the Laurent series ring. Ifprec
is \(\infty\), then this returns aLazyLaurentSeriesRing
.EXAMPLES:
sage: P.<x> = LaurentPolynomialRing(QQ); P Univariate Laurent Polynomial Ring in x over Rational Field sage: PP = P.completion(x); PP Laurent Series Ring in x over Rational Field sage: f = 1 - 1/x sage: PP(f) -x^-1 + 1 sage: g = 1 / PP(f); g -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) sage: 1 / g -x^-1 + 1 + O(x^19) sage: # needs sage.combinat sage: PP = P.completion(x, prec=oo); PP Lazy Laurent Series Ring in x over Rational Field sage: g = 1 / PP(f); g -x - x^2 - x^3 + O(x^4) sage: 1 / g == f True
>>> from sage.all import * >>> P = LaurentPolynomialRing(QQ, names=('x',)); (x,) = P._first_ngens(1); P Univariate Laurent Polynomial Ring in x over Rational Field >>> PP = P.completion(x); PP Laurent Series Ring in x over Rational Field >>> f = Integer(1) - Integer(1)/x >>> PP(f) -x^-1 + 1 >>> g = Integer(1) / PP(f); g -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) >>> Integer(1) / g -x^-1 + 1 + O(x^19) >>> # needs sage.combinat >>> PP = P.completion(x, prec=oo); PP Lazy Laurent Series Ring in x over Rational Field >>> g = Integer(1) / PP(f); g -x - x^2 - x^3 + O(x^4) >>> Integer(1) / g == f True
- construction()[source]¶
Return the construction of
self
.EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x,y').construction() (LaurentPolynomialFunctor, Univariate Laurent Polynomial Ring in x over Rational Field)
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x,y').construction() (LaurentPolynomialFunctor, Univariate Laurent Polynomial Ring in x over Rational Field)
- fraction_field()[source]¶
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)
>>> from sage.all import * >>> L = LaurentPolynomialRing(QQ, names=('x',)); (x,) = L._first_ngens(1) >>> L.fraction_field() Fraction Field of Univariate Polynomial Ring in x over Rational Field >>> (x**-Integer(1) + Integer(2)) / (x - Integer(1)) (2*x + 1)/(x^2 - x)
- gen(i=0)[source]¶
Return 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
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').gen() x0 >>> LaurentPolynomialRing(QQ, Integer(2), 'x').gen(Integer(0)) x0 >>> LaurentPolynomialRing(QQ, Integer(2), 'x').gen(Integer(1)) x1
- ideal(*args, **kwds)[source]¶
EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').ideal([1]) Ideal (1) of Multivariate Laurent Polynomial Ring in x0, x1 over Rational Field
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').ideal([Integer(1)]) Ideal (1) of Multivariate Laurent Polynomial Ring in x0, x1 over Rational Field
- is_exact()[source]¶
Return
True
if the base ring is exact.EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').is_exact() True sage: LaurentPolynomialRing(RDF, 2, 'x').is_exact() False
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').is_exact() True >>> LaurentPolynomialRing(RDF, Integer(2), 'x').is_exact() False
- is_field(proof=True)[source]¶
EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').is_field() False
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').is_field() False
- is_finite()[source]¶
EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').is_finite() False
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').is_finite() False
- is_integral_domain(proof=True)[source]¶
Return
True
ifself
is an integral domain.EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').is_integral_domain() True
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').is_integral_domain() True
The following used to fail; see Issue #7530:
sage: L = LaurentPolynomialRing(ZZ, 'X') sage: L['Y'] Univariate Polynomial Ring in Y over Univariate Laurent Polynomial Ring in X over Integer Ring
>>> from sage.all import * >>> L = LaurentPolynomialRing(ZZ, 'X') >>> L['Y'] Univariate Polynomial Ring in Y over Univariate Laurent Polynomial Ring in X over Integer Ring
- is_noetherian()[source]¶
Return
True
ifself
is Noetherian.EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').is_noetherian() True
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').is_noetherian() True
- krull_dimension()[source]¶
EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').krull_dimension() Traceback (most recent call last): ... NotImplementedError
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').krull_dimension() Traceback (most recent call last): ... NotImplementedError
- ngens()[source]¶
Return the number of generators of
self
.EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').ngens() 2 sage: LaurentPolynomialRing(QQ, 1, 'x').ngens() 1
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').ngens() 2 >>> LaurentPolynomialRing(QQ, Integer(1), 'x').ngens() 1
- polynomial_ring()[source]¶
Return 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
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').polynomial_ring() Multivariate Polynomial Ring in x0, x1 over Rational Field >>> LaurentPolynomialRing(QQ, Integer(1), 'x').polynomial_ring() Multivariate Polynomial Ring in x over Rational Field
- random_element(min_valuation=-2, max_degree=2, *args, **kwds)[source]¶
Return a random polynomial with degree at most
max_degree
and lowest valuation at leastmin_valuation
.Uses the random sampling from the base polynomial ring then divides out by a monomial to ensure correct
max_degree
andmin_valuation
.INPUT:
min_valuation
– integer (default: \(-2\)); the minimal allowed valuation of the polynomialmax_degree
– integer (default: \(2\)); the maximal allowed degree of the polynomial*args
,**kwds
– passed to the random element generator of the base polynomial ring and base ring itself
EXAMPLES:
sage: L.<x> = LaurentPolynomialRing(QQ) sage: f = L.random_element() sage: f.degree() <= 2 True sage: f.valuation() >= -2 True sage: f.parent() is L True
>>> from sage.all import * >>> L = LaurentPolynomialRing(QQ, names=('x',)); (x,) = L._first_ngens(1) >>> f = L.random_element() >>> f.degree() <= Integer(2) True >>> f.valuation() >= -Integer(2) True >>> f.parent() is L True
sage: L = LaurentPolynomialRing(ZZ, 2, 'x') sage: f = L.random_element(10, 20) sage: f.degree() <= 20 True sage: f.valuation() >= 10 True sage: f.parent() is L True
>>> from sage.all import * >>> L = LaurentPolynomialRing(ZZ, Integer(2), 'x') >>> f = L.random_element(Integer(10), Integer(20)) >>> f.degree() <= Integer(20) True >>> f.valuation() >= Integer(10) True >>> f.parent() is L True
sage: L = LaurentPolynomialRing(GF(13), 3, 'x') sage: f = L.random_element(-10, -1) sage: f.degree() <= -1 True sage: f.valuation() >= -10 True sage: f.parent() is L True
>>> from sage.all import * >>> L = LaurentPolynomialRing(GF(Integer(13)), Integer(3), 'x') >>> f = L.random_element(-Integer(10), -Integer(1)) >>> f.degree() <= -Integer(1) True >>> f.valuation() >= -Integer(10) True >>> f.parent() is L True
sage: L.<x, y> = LaurentPolynomialRing(RR) sage: f = L.random_element() sage: f.degree() <= 2 True sage: f.valuation() >= -2 True sage: f.parent() is L True
>>> from sage.all import * >>> L = LaurentPolynomialRing(RR, names=('x', 'y',)); (x, y,) = L._first_ngens(2) >>> f = L.random_element() >>> f.degree() <= Integer(2) True >>> f.valuation() >= -Integer(2) True >>> f.parent() is L True
sage: L = LaurentPolynomialRing(QQbar, 5, 'x') sage: f = L.random_element(-1, 1) sage: f = L.random_element(-1, 1) sage: f.degree() <= 1 True sage: f.valuation() >= -1 True sage: f.parent() is L True
>>> from sage.all import * >>> L = LaurentPolynomialRing(QQbar, Integer(5), 'x') >>> f = L.random_element(-Integer(1), Integer(1)) >>> f = L.random_element(-Integer(1), Integer(1)) >>> f.degree() <= Integer(1) True >>> f.valuation() >= -Integer(1) True >>> f.parent() is L True
- remove_var(var)[source]¶
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
>>> from sage.all import * >>> R = LaurentPolynomialRing(QQ,'x,y,z') >>> R.remove_var('x') Multivariate Laurent Polynomial Ring in y, z over Rational Field >>> R.remove_var('x').remove_var('y') Univariate Laurent Polynomial Ring in z over Rational Field
- term_order()[source]¶
Return the term order of
self
.EXAMPLES:
sage: LaurentPolynomialRing(QQ, 2, 'x').term_order() Degree reverse lexicographic term order
>>> from sage.all import * >>> LaurentPolynomialRing(QQ, Integer(2), 'x').term_order() Degree reverse lexicographic term order
- variable_names_recursive(depth=+Infinity)[source]¶
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
– 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')
>>> from sage.all import * >>> T = LaurentPolynomialRing(QQ, 'x') >>> S = LaurentPolynomialRing(T, 'y') >>> R = LaurentPolynomialRing(S, 'z') >>> R.variable_names_recursive() ('x', 'y', 'z') >>> R.variable_names_recursive(Integer(2)) ('y', 'z')