Rings¶
This module provides the abstract base class Ring
from which
all rings in Sage (used to) derive, as well as a selection of more
specific base classes.
Warning
Those classes, except maybe for the lowest ones like
CommutativeRing
and Field
,
are being progressively deprecated in favor of the corresponding
categories. which are more flexible, in particular with respect to multiple
inheritance.
The class inheritance hierarchy is:
Ring
(to be deprecated)Algebra
(deprecated and essentially removed)-
NoetherianRing
(deprecated and essentially removed)CommutativeAlgebra
(deprecated and essentially removed)IntegralDomain
(deprecated)DedekindDomain
(deprecated and essentially removed)PrincipalIdealDomain
(deprecated and essentially removed)
Subclasses of CommutativeRing
are
Some aspects of this structure may seem strange, but this is an unfortunate consequence of the fact that Cython classes do not support multiple inheritance.
(A distinct but equally awkward issue is that sometimes we may not know in
advance whether or not a ring belongs in one of these classes; e.g. some
orders in number fields are Dedekind domains, but others are not, and we still
want to offer a unified interface, so orders are never instances of the
deprecated DedekindDomain
class.)
AUTHORS:
David Harvey (2006-10-16): changed
CommutativeAlgebra
to derive fromCommutativeRing
instead of fromAlgebra
.David Loeffler (2009-07-09): documentation fixes, added to reference manual.
Simon King (2011-03-29): Proper use of the category framework for rings.
Simon King (2011-05-20): Modify multiplication and _ideal_class_ to support ideals of non-commutative rings.
- class sage.rings.ring.CommutativeAlgebra[source]¶
Bases:
CommutativeRing
- class sage.rings.ring.CommutativeRing[source]¶
Bases:
Ring
Generic commutative ring.
- extension(poly, name=None, names=None, **kwds)[source]¶
Algebraically extend
self
by taking the quotientself[x] / (f(x))
.INPUT:
poly
– a polynomial whose coefficients are coercible intoself
name
– (optional) name for the root of \(f\)
Note
Using this method on an algebraically complete field does not return this field; the construction
self[x] / (f(x))
is done anyway.EXAMPLES:
sage: R = QQ['x'] sage: y = polygen(R) sage: R.extension(y^2 - 5, 'a') # needs sage.libs.pari Univariate Quotient Polynomial Ring in a over Univariate Polynomial Ring in x over Rational Field with modulus a^2 - 5
>>> from sage.all import * >>> R = QQ['x'] >>> y = polygen(R) >>> R.extension(y**Integer(2) - Integer(5), 'a') # needs sage.libs.pari Univariate Quotient Polynomial Ring in a over Univariate Polynomial Ring in x over Rational Field with modulus a^2 - 5
sage: # needs sage.rings.finite_rings sage: P.<x> = PolynomialRing(GF(5)) sage: F.<a> = GF(5).extension(x^2 - 2) sage: P.<t> = F[] sage: R.<b> = F.extension(t^2 - a); R Univariate Quotient Polynomial Ring in b over Finite Field in a of size 5^2 with modulus b^2 + 4*a
>>> from sage.all import * >>> # needs sage.rings.finite_rings >>> P = PolynomialRing(GF(Integer(5)), names=('x',)); (x,) = P._first_ngens(1) >>> F = GF(Integer(5)).extension(x**Integer(2) - Integer(2), names=('a',)); (a,) = F._first_ngens(1) >>> P = F['t']; (t,) = P._first_ngens(1) >>> R = F.extension(t**Integer(2) - a, names=('b',)); (b,) = R._first_ngens(1); R Univariate Quotient Polynomial Ring in b over Finite Field in a of size 5^2 with modulus b^2 + 4*a
- fraction_field()[source]¶
Return the fraction field of
self
.EXAMPLES:
sage: R = Integers(389)['x,y'] sage: Frac(R) Fraction Field of Multivariate Polynomial Ring in x, y over Ring of integers modulo 389 sage: R.fraction_field() Fraction Field of Multivariate Polynomial Ring in x, y over Ring of integers modulo 389
>>> from sage.all import * >>> R = Integers(Integer(389))['x,y'] >>> Frac(R) Fraction Field of Multivariate Polynomial Ring in x, y over Ring of integers modulo 389 >>> R.fraction_field() Fraction Field of Multivariate Polynomial Ring in x, y over Ring of integers modulo 389
- is_commutative()[source]¶
Return
True
, since this ring is commutative.EXAMPLES:
sage: QQ.is_commutative() True sage: ZpCA(7).is_commutative() # needs sage.rings.padics True sage: A = QuaternionAlgebra(QQ, -1, -3, names=('i','j','k')); A # needs sage.combinat sage.modules Quaternion Algebra (-1, -3) with base ring Rational Field sage: A.is_commutative() # needs sage.combinat sage.modules False
>>> from sage.all import * >>> QQ.is_commutative() True >>> ZpCA(Integer(7)).is_commutative() # needs sage.rings.padics True >>> A = QuaternionAlgebra(QQ, -Integer(1), -Integer(3), names=('i','j','k')); A # needs sage.combinat sage.modules Quaternion Algebra (-1, -3) with base ring Rational Field >>> A.is_commutative() # needs sage.combinat sage.modules False
- krull_dimension()[source]¶
Return the Krull dimension of this commutative ring.
The Krull dimension is the length of the longest ascending chain of prime ideals.
- localization(additional_units, names=None, normalize=True, category=None)[source]¶
Return the localization of
self
at the given additional units.EXAMPLES:
sage: R.<x, y> = GF(3)[] sage: R.localization((x*y, x**2 + y**2)) # needs sage.rings.finite_rings Multivariate Polynomial Ring in x, y over Finite Field of size 3 localized at (y, x, x^2 + y^2) sage: ~y in _ # needs sage.rings.finite_rings True
>>> from sage.all import * >>> R = GF(Integer(3))['x, y']; (x, y,) = R._first_ngens(2) >>> R.localization((x*y, x**Integer(2) + y**Integer(2))) # needs sage.rings.finite_rings Multivariate Polynomial Ring in x, y over Finite Field of size 3 localized at (y, x, x^2 + y^2) >>> ~y in _ # needs sage.rings.finite_rings True
- class sage.rings.ring.DedekindDomain[source]¶
Bases:
CommutativeRing
- class sage.rings.ring.Field[source]¶
Bases:
CommutativeRing
Generic field
- algebraic_closure()[source]¶
Return the algebraic closure of
self
.Note
This is only implemented for certain classes of field.
EXAMPLES:
sage: K = PolynomialRing(QQ,'x').fraction_field(); K Fraction Field of Univariate Polynomial Ring in x over Rational Field sage: K.algebraic_closure() Traceback (most recent call last): ... NotImplementedError: Algebraic closures of general fields not implemented.
>>> from sage.all import * >>> K = PolynomialRing(QQ,'x').fraction_field(); K Fraction Field of Univariate Polynomial Ring in x over Rational Field >>> K.algebraic_closure() Traceback (most recent call last): ... NotImplementedError: Algebraic closures of general fields not implemented.
- an_embedding(K)[source]¶
Return some embedding of this field into another field \(K\), and raise a
ValueError
if none exists.EXAMPLES:
sage: GF(2).an_embedding(GF(4)) Ring morphism: From: Finite Field of size 2 To: Finite Field in z2 of size 2^2 Defn: 1 |--> 1 sage: GF(4).an_embedding(GF(8)) Traceback (most recent call last): ... ValueError: no embedding from Finite Field in z2 of size 2^2 to Finite Field in z3 of size 2^3 sage: GF(4).an_embedding(GF(16)) Ring morphism: From: Finite Field in z2 of size 2^2 To: Finite Field in z4 of size 2^4 Defn: z2 |--> z4^2 + z4
>>> from sage.all import * >>> GF(Integer(2)).an_embedding(GF(Integer(4))) Ring morphism: From: Finite Field of size 2 To: Finite Field in z2 of size 2^2 Defn: 1 |--> 1 >>> GF(Integer(4)).an_embedding(GF(Integer(8))) Traceback (most recent call last): ... ValueError: no embedding from Finite Field in z2 of size 2^2 to Finite Field in z3 of size 2^3 >>> GF(Integer(4)).an_embedding(GF(Integer(16))) Ring morphism: From: Finite Field in z2 of size 2^2 To: Finite Field in z4 of size 2^4 Defn: z2 |--> z4^2 + z4
sage: CyclotomicField(5).an_embedding(QQbar) Coercion map: From: Cyclotomic Field of order 5 and degree 4 To: Algebraic Field sage: CyclotomicField(3).an_embedding(CyclotomicField(7)) Traceback (most recent call last): ... ValueError: no embedding from Cyclotomic Field of order 3 and degree 2 to Cyclotomic Field of order 7 and degree 6 sage: CyclotomicField(3).an_embedding(CyclotomicField(6)) Generic morphism: From: Cyclotomic Field of order 3 and degree 2 To: Cyclotomic Field of order 6 and degree 2 Defn: zeta3 -> zeta6 - 1
>>> from sage.all import * >>> CyclotomicField(Integer(5)).an_embedding(QQbar) Coercion map: From: Cyclotomic Field of order 5 and degree 4 To: Algebraic Field >>> CyclotomicField(Integer(3)).an_embedding(CyclotomicField(Integer(7))) Traceback (most recent call last): ... ValueError: no embedding from Cyclotomic Field of order 3 and degree 2 to Cyclotomic Field of order 7 and degree 6 >>> CyclotomicField(Integer(3)).an_embedding(CyclotomicField(Integer(6))) Generic morphism: From: Cyclotomic Field of order 3 and degree 2 To: Cyclotomic Field of order 6 and degree 2 Defn: zeta3 -> zeta6 - 1
- divides(x, y, coerce=True)[source]¶
Return
True
ifx
dividesy
in this field (usuallyTrue
in a field!). Ifcoerce
isTrue
(the default), first coercex
andy
intoself
.EXAMPLES:
sage: QQ.divides(2, 3/4) True sage: QQ.divides(0, 5) False
>>> from sage.all import * >>> QQ.divides(Integer(2), Integer(3)/Integer(4)) True >>> QQ.divides(Integer(0), Integer(5)) False
- fraction_field()[source]¶
Return the fraction field of
self
.EXAMPLES:
Since fields are their own field of fractions, we simply get the original field in return:
sage: QQ.fraction_field() Rational Field sage: RR.fraction_field() # needs sage.rings.real_mpfr Real Field with 53 bits of precision sage: CC.fraction_field() # needs sage.rings.real_mpfr Complex Field with 53 bits of precision sage: x = polygen(ZZ, 'x') sage: F = NumberField(x^2 + 1, 'i') # needs sage.rings.number_field sage: F.fraction_field() # needs sage.rings.number_field Number Field in i with defining polynomial x^2 + 1
>>> from sage.all import * >>> QQ.fraction_field() Rational Field >>> RR.fraction_field() # needs sage.rings.real_mpfr Real Field with 53 bits of precision >>> CC.fraction_field() # needs sage.rings.real_mpfr Complex Field with 53 bits of precision >>> x = polygen(ZZ, 'x') >>> F = NumberField(x**Integer(2) + Integer(1), 'i') # needs sage.rings.number_field >>> F.fraction_field() # needs sage.rings.number_field Number Field in i with defining polynomial x^2 + 1
- integral_closure()[source]¶
Return this field, since fields are integrally closed in their fraction field.
EXAMPLES:
sage: QQ.integral_closure() Rational Field sage: Frac(ZZ['x,y']).integral_closure() Fraction Field of Multivariate Polynomial Ring in x, y over Integer Ring
>>> from sage.all import * >>> QQ.integral_closure() Rational Field >>> Frac(ZZ['x,y']).integral_closure() Fraction Field of Multivariate Polynomial Ring in x, y over Integer Ring
- is_field(proof=True)[source]¶
Return
True
since this is a field.EXAMPLES:
sage: Frac(ZZ['x,y']).is_field() True
>>> from sage.all import * >>> Frac(ZZ['x,y']).is_field() True
- is_integrally_closed()[source]¶
Return
True
since fields are trivially integrally closed in their fraction field (since they are their own fraction field).EXAMPLES:
sage: Frac(ZZ['x,y']).is_integrally_closed() True
>>> from sage.all import * >>> Frac(ZZ['x,y']).is_integrally_closed() True
- krull_dimension()[source]¶
Return the Krull dimension of this field, which is 0.
EXAMPLES:
sage: QQ.krull_dimension() 0 sage: Frac(QQ['x,y']).krull_dimension() 0
>>> from sage.all import * >>> QQ.krull_dimension() 0 >>> Frac(QQ['x,y']).krull_dimension() 0
- prime_subfield()[source]¶
Return the prime subfield of
self
.EXAMPLES:
sage: k = GF(9, 'a') # needs sage.rings.finite_rings sage: k.prime_subfield() # needs sage.rings.finite_rings Finite Field of size 3
>>> from sage.all import * >>> k = GF(Integer(9), 'a') # needs sage.rings.finite_rings >>> k.prime_subfield() # needs sage.rings.finite_rings Finite Field of size 3
- class sage.rings.ring.IntegralDomain[source]¶
Bases:
CommutativeRing
Generic integral domain class.
This class is deprecated. Please use the
sage.categories.integral_domains.IntegralDomains
category instead.- is_field(proof=True)[source]¶
Return
True
if this ring is a field.EXAMPLES:
sage: GF(7).is_field() True
>>> from sage.all import * >>> GF(Integer(7)).is_field() True
The following examples have their own
is_field
implementations:sage: ZZ.is_field(); QQ.is_field() False True sage: R.<x> = PolynomialRing(QQ); R.is_field() False
>>> from sage.all import * >>> ZZ.is_field(); QQ.is_field() False True >>> R = PolynomialRing(QQ, names=('x',)); (x,) = R._first_ngens(1); R.is_field() False
- is_integrally_closed()[source]¶
Return
True
if this ring is integrally closed in its field of fractions; otherwise returnFalse
.When no algorithm is implemented for this, then this function raises a
NotImplementedError
.Note that
is_integrally_closed
has a naive implementation in fields. For every field \(F\), \(F\) is its own field of fractions, hence every element of \(F\) is integral over \(F\).EXAMPLES:
sage: ZZ.is_integrally_closed() True sage: QQ.is_integrally_closed() True sage: QQbar.is_integrally_closed() # needs sage.rings.number_field True sage: GF(5).is_integrally_closed() True sage: Z5 = Integers(5); Z5 Ring of integers modulo 5 sage: Z5.is_integrally_closed() Traceback (most recent call last): ... AttributeError: 'IntegerModRing_generic_with_category' object has no attribute 'is_integrally_closed'...
>>> from sage.all import * >>> ZZ.is_integrally_closed() True >>> QQ.is_integrally_closed() True >>> QQbar.is_integrally_closed() # needs sage.rings.number_field True >>> GF(Integer(5)).is_integrally_closed() True >>> Z5 = Integers(Integer(5)); Z5 Ring of integers modulo 5 >>> Z5.is_integrally_closed() Traceback (most recent call last): ... AttributeError: 'IntegerModRing_generic_with_category' object has no attribute 'is_integrally_closed'...
- class sage.rings.ring.NoetherianRing[source]¶
Bases:
CommutativeRing
- class sage.rings.ring.PrincipalIdealDomain[source]¶
Bases:
CommutativeRing
- class sage.rings.ring.Ring[source]¶
Bases:
ParentWithGens
Generic ring class.
- base_extend(R)[source]¶
EXAMPLES:
sage: QQ.base_extend(GF(7)) Traceback (most recent call last): ... TypeError: no base extension defined sage: ZZ.base_extend(GF(7)) Finite Field of size 7
>>> from sage.all import * >>> QQ.base_extend(GF(Integer(7))) Traceback (most recent call last): ... TypeError: no base extension defined >>> ZZ.base_extend(GF(Integer(7))) Finite Field of size 7
- category()[source]¶
Return the category to which this ring belongs.
Note
This method exists because sometimes a ring is its own base ring. During initialisation of a ring \(R\), it may be checked whether the base ring (hence, the ring itself) is a ring. Hence, it is necessary that
R.category()
tells thatR
is a ring, even before its category is properly initialised.EXAMPLES:
sage: FreeAlgebra(QQ, 3, 'x').category() # todo: use a ring which is not an algebra! # needs sage.combinat sage.modules Category of algebras with basis over Rational Field
>>> from sage.all import * >>> FreeAlgebra(QQ, Integer(3), 'x').category() # todo: use a ring which is not an algebra! # needs sage.combinat sage.modules Category of algebras with basis over Rational Field
Since a quotient of the integers is its own base ring, and during initialisation of a ring it is tested whether the base ring belongs to the category of rings, the following is an indirect test that the
category()
method of rings returns the category of rings even before the initialisation was successful:sage: I = Integers(15) sage: I.base_ring() is I True sage: I.category() Join of Category of finite commutative rings and Category of subquotients of monoids and Category of quotients of semigroups and Category of finite enumerated sets
>>> from sage.all import * >>> I = Integers(Integer(15)) >>> I.base_ring() is I True >>> I.category() Join of Category of finite commutative rings and Category of subquotients of monoids and Category of quotients of semigroups and Category of finite enumerated sets
- epsilon()[source]¶
Return the precision error of elements in this ring.
EXAMPLES:
sage: RDF.epsilon() 2.220446049250313e-16 sage: ComplexField(53).epsilon() # needs sage.rings.real_mpfr 2.22044604925031e-16 sage: RealField(10).epsilon() # needs sage.rings.real_mpfr 0.0020
>>> from sage.all import * >>> RDF.epsilon() 2.220446049250313e-16 >>> ComplexField(Integer(53)).epsilon() # needs sage.rings.real_mpfr 2.22044604925031e-16 >>> RealField(Integer(10)).epsilon() # needs sage.rings.real_mpfr 0.0020
For exact rings, zero is returned:
sage: ZZ.epsilon() 0
>>> from sage.all import * >>> ZZ.epsilon() 0
This also works over derived rings:
sage: RR['x'].epsilon() # needs sage.rings.real_mpfr 2.22044604925031e-16 sage: QQ['x'].epsilon() 0
>>> from sage.all import * >>> RR['x'].epsilon() # needs sage.rings.real_mpfr 2.22044604925031e-16 >>> QQ['x'].epsilon() 0
For the symbolic ring, there is no reasonable answer:
sage: SR.epsilon() # needs sage.symbolic Traceback (most recent call last): ... NotImplementedError
>>> from sage.all import * >>> SR.epsilon() # needs sage.symbolic Traceback (most recent call last): ... NotImplementedError
- is_exact()[source]¶
Return
True
if elements of this ring are represented exactly, i.e., there is no precision loss when doing arithmetic.Note
This defaults to
True
, so even if it does returnTrue
you have no guarantee (unless the ring has properly overloaded this).EXAMPLES:
sage: QQ.is_exact() # indirect doctest True sage: ZZ.is_exact() True sage: Qp(7).is_exact() # needs sage.rings.padics False sage: Zp(7, type='capped-abs').is_exact() # needs sage.rings.padics False
>>> from sage.all import * >>> QQ.is_exact() # indirect doctest True >>> ZZ.is_exact() True >>> Qp(Integer(7)).is_exact() # needs sage.rings.padics False >>> Zp(Integer(7), type='capped-abs').is_exact() # needs sage.rings.padics False
- is_field(proof=True)[source]¶
Return
True
if this ring is a field.INPUT:
proof
– boolean (default:True
); determines what to do in unknown cases
ALGORITHM:
If the parameter
proof
is set toTrue
, the returned value is correct but the method might throw an error. Otherwise, if it is set toFalse
, the method returnsTrue
if it can establish thatself
is a field andFalse
otherwise.EXAMPLES:
sage: QQ.is_field() True sage: GF(9, 'a').is_field() # needs sage.rings.finite_rings True sage: ZZ.is_field() False sage: QQ['x'].is_field() False sage: Frac(QQ['x']).is_field() True
>>> from sage.all import * >>> QQ.is_field() True >>> GF(Integer(9), 'a').is_field() # needs sage.rings.finite_rings True >>> ZZ.is_field() False >>> QQ['x'].is_field() False >>> Frac(QQ['x']).is_field() True
This illustrates the use of the
proof
parameter:sage: R.<a,b> = QQ[] sage: S.<x,y> = R.quo((b^3)) # needs sage.libs.singular sage: S.is_field(proof=True) # needs sage.libs.singular Traceback (most recent call last): ... NotImplementedError sage: S.is_field(proof=False) # needs sage.libs.singular False
>>> from sage.all import * >>> R = QQ['a, b']; (a, b,) = R._first_ngens(2) >>> S = R.quo((b**Integer(3)), names=('x', 'y',)); (x, y,) = S._first_ngens(2)# needs sage.libs.singular >>> S.is_field(proof=True) # needs sage.libs.singular Traceback (most recent call last): ... NotImplementedError >>> S.is_field(proof=False) # needs sage.libs.singular False
- one()[source]¶
Return the one element of this ring (cached), if it exists.
EXAMPLES:
sage: ZZ.one() 1 sage: QQ.one() 1 sage: QQ['x'].one() 1
>>> from sage.all import * >>> ZZ.one() 1 >>> QQ.one() 1 >>> QQ['x'].one() 1
The result is cached:
sage: ZZ.one() is ZZ.one() True
>>> from sage.all import * >>> ZZ.one() is ZZ.one() True
- order()[source]¶
The number of elements of
self
.EXAMPLES:
sage: GF(19).order() 19 sage: QQ.order() +Infinity
>>> from sage.all import * >>> GF(Integer(19)).order() 19 >>> QQ.order() +Infinity
- random_element(bound=2)[source]¶
Return a random integer coerced into this ring, where the integer is chosen uniformly from the interval
[-bound,bound]
.INPUT:
bound
– integer (default: 2)
ALGORITHM:
Uses Python’s randint.
- zero()[source]¶
Return the zero element of this ring (cached).
EXAMPLES:
sage: ZZ.zero() 0 sage: QQ.zero() 0 sage: QQ['x'].zero() 0
>>> from sage.all import * >>> ZZ.zero() 0 >>> QQ.zero() 0 >>> QQ['x'].zero() 0
The result is cached:
sage: ZZ.zero() is ZZ.zero() True
>>> from sage.all import * >>> ZZ.zero() is ZZ.zero() True
- zeta(n=2, all=False)[source]¶
Return a primitive
n
-th root of unity inself
if there is one, or raise aValueError
otherwise.INPUT:
n
– positive integerall
– boolean (default:False
); whether to return a list of all primitive \(n\)-th roots of unity. IfTrue
, raise aValueError
ifself
is not an integral domain.
OUTPUT: element of
self
of finite orderEXAMPLES:
sage: QQ.zeta() -1 sage: QQ.zeta(1) 1 sage: CyclotomicField(6).zeta(6) # needs sage.rings.number_field zeta6 sage: CyclotomicField(3).zeta(3) # needs sage.rings.number_field zeta3 sage: CyclotomicField(3).zeta(3).multiplicative_order() # needs sage.rings.number_field 3 sage: # needs sage.rings.finite_rings sage: a = GF(7).zeta(); a 3 sage: a.multiplicative_order() 6 sage: a = GF(49,'z').zeta(); a z sage: a.multiplicative_order() 48 sage: a = GF(49,'z').zeta(2); a 6 sage: a.multiplicative_order() 2 sage: QQ.zeta(3) Traceback (most recent call last): ... ValueError: no n-th root of unity in rational field sage: Zp(7, prec=8).zeta() # needs sage.rings.padics 3 + 4*7 + 6*7^2 + 3*7^3 + 2*7^5 + 6*7^6 + 2*7^7 + O(7^8)
>>> from sage.all import * >>> QQ.zeta() -1 >>> QQ.zeta(Integer(1)) 1 >>> CyclotomicField(Integer(6)).zeta(Integer(6)) # needs sage.rings.number_field zeta6 >>> CyclotomicField(Integer(3)).zeta(Integer(3)) # needs sage.rings.number_field zeta3 >>> CyclotomicField(Integer(3)).zeta(Integer(3)).multiplicative_order() # needs sage.rings.number_field 3 >>> # needs sage.rings.finite_rings >>> a = GF(Integer(7)).zeta(); a 3 >>> a.multiplicative_order() 6 >>> a = GF(Integer(49),'z').zeta(); a z >>> a.multiplicative_order() 48 >>> a = GF(Integer(49),'z').zeta(Integer(2)); a 6 >>> a.multiplicative_order() 2 >>> QQ.zeta(Integer(3)) Traceback (most recent call last): ... ValueError: no n-th root of unity in rational field >>> Zp(Integer(7), prec=Integer(8)).zeta() # needs sage.rings.padics 3 + 4*7 + 6*7^2 + 3*7^3 + 2*7^5 + 6*7^6 + 2*7^7 + O(7^8)
- zeta_order()[source]¶
Return the order of the distinguished root of unity in
self
.EXAMPLES:
sage: CyclotomicField(19).zeta_order() # needs sage.rings.number_field 38 sage: GF(19).zeta_order() 18 sage: GF(5^3,'a').zeta_order() # needs sage.rings.finite_rings 124 sage: Zp(7, prec=8).zeta_order() # needs sage.rings.padics 6
>>> from sage.all import * >>> CyclotomicField(Integer(19)).zeta_order() # needs sage.rings.number_field 38 >>> GF(Integer(19)).zeta_order() 18 >>> GF(Integer(5)**Integer(3),'a').zeta_order() # needs sage.rings.finite_rings 124 >>> Zp(Integer(7), prec=Integer(8)).zeta_order() # needs sage.rings.padics 6
- sage.rings.ring.is_Ring(x)[source]¶
Return
True
ifx
is a ring.EXAMPLES:
sage: from sage.rings.ring import is_Ring sage: is_Ring(ZZ) doctest:warning... DeprecationWarning: The function is_Ring is deprecated; use '... in Rings()' instead See https://github.com/sagemath/sage/issues/38288 for details. True sage: MS = MatrixSpace(QQ, 2) # needs sage.modules sage: is_Ring(MS) # needs sage.modules True
>>> from sage.all import * >>> from sage.rings.ring import is_Ring >>> is_Ring(ZZ) doctest:warning... DeprecationWarning: The function is_Ring is deprecated; use '... in Rings()' instead See https://github.com/sagemath/sage/issues/38288 for details. True >>> MS = MatrixSpace(QQ, Integer(2)) # needs sage.modules >>> is_Ring(MS) # needs sage.modules True