Rings¶
-
class
sage.categories.rings.
Rings
(base_category)¶ Bases:
sage.categories.category_with_axiom.CategoryWithAxiom_singleton
The category of rings
Associative rings with unit, not necessarily commutative
EXAMPLES:
sage: Rings() Category of rings sage: sorted(Rings().super_categories(), key=str) [Category of rngs, Category of semirings] sage: sorted(Rings().axioms()) ['AdditiveAssociative', 'AdditiveCommutative', 'AdditiveInverse', 'AdditiveUnital', 'Associative', 'Distributive', 'Unital'] sage: Rings() is (CommutativeAdditiveGroups() & Monoids()).Distributive() True sage: Rings() is Rngs().Unital() True sage: Rings() is Semirings().AdditiveInverse() True
TESTS:
sage: TestSuite(Rings()).run()
Todo
(see: http://trac.sagemath.org/sage_trac/wiki/CategoriesRoadMap)
- Make Rings() into a subcategory or alias of Algebras(ZZ);
- A parent P in the category
Rings()
should automatically be in the categoryAlgebras(P)
.
-
Commutative
¶ alias of
CommutativeRings
-
Division
¶ alias of
DivisionRings
-
class
ElementMethods
¶ -
is_unit
()¶ Return whether this element is a unit in the ring.
Note
This is a generic implementation for (non-commutative) rings which only works for the one element, its additive inverse, and the zero element. Most rings should provide a more specialized implementation.
EXAMPLES:
sage: MS = MatrixSpace(ZZ, 2) sage: MS.one().is_unit() True sage: MS.zero().is_unit() False sage: MS([1,2,3,4]).is_unit() False
-
-
class
Rings.
ParentMethods
¶ -
bracket
(x, y)¶ Returns the Lie bracket \([x, y] = x y - y x\) of \(x\) and \(y\).
INPUT:
x
,y
– elements ofself
EXAMPLES:
sage: F = AlgebrasWithBasis(QQ).example() sage: F An example of an algebra with basis: the free algebra on the generators ('a', 'b', 'c') over Rational Field sage: a,b,c = F.algebra_generators() sage: F.bracket(a,b) B[word: ab] - B[word: ba]
This measures the default of commutation between \(x\) and \(y\). \(F\) endowed with the bracket operation is a Lie algebra; in particular, it satisfies Jacobi’s identity:
sage: F.bracket( F.bracket(a,b), c) + F.bracket(F.bracket(b,c),a) + F.bracket(F.bracket(c,a),b) 0
-
characteristic
()¶ Return the characteristic of this ring.
EXAMPLES:
sage: QQ.characteristic() 0 sage: GF(19).characteristic() 19 sage: Integers(8).characteristic() 8 sage: Zp(5).characteristic() 0
-
ideal
(*args, **kwds)¶ Create an ideal of this ring.
NOTE:
The code is copied from the base class
Ring
. This is because there are rings that do not inherit from that class, such as matrix algebras. See trac ticket #7797.INPUT:
- An element or a list/tuple/sequence of elements.
coerce
(optional bool, defaultTrue
): First coerce the elements into this ring.side
, optional string, one of"twosided"
(default),"left"
,"right"
: determines whether the resulting ideal is twosided, a left ideal or a right ideal.
EXAMPLE:
sage: MS = MatrixSpace(QQ,2,2) sage: isinstance(MS,Ring) False sage: MS in Rings() True sage: MS.ideal(2) Twosided Ideal ( [2 0] [0 2] ) of Full MatrixSpace of 2 by 2 dense matrices over Rational Field sage: MS.ideal([MS.0,MS.1],side='right') Right Ideal ( [1 0] [0 0], <BLANKLINE> [0 1] [0 0] ) of Full MatrixSpace of 2 by 2 dense matrices over Rational Field
-
ideal_monoid
()¶ The monoid of the ideals of this ring.
NOTE:
The code is copied from the base class of rings. This is since there are rings that do not inherit from that class, such as matrix algebras. See trac ticket #7797.
EXAMPLE:
sage: MS = MatrixSpace(QQ,2,2) sage: isinstance(MS,Ring) False sage: MS in Rings() True sage: MS.ideal_monoid() Monoid of ideals of Full MatrixSpace of 2 by 2 dense matrices over Rational Field
Note that the monoid is cached:
sage: MS.ideal_monoid() is MS.ideal_monoid() True
-
is_ring
()¶ Return True, since this in an object of the category of rings.
EXAMPLES:
sage: Parent(QQ,category=Rings()).is_ring() True
-
is_zero
()¶ Return
True
if this is the zero ring.EXAMPLES:
sage: Integers(1).is_zero() True sage: Integers(2).is_zero() False sage: QQ.is_zero() False sage: R.<x> = ZZ[] sage: R.quo(1).is_zero() True sage: R.<x> = GF(101)[] sage: R.quo(77).is_zero() True sage: R.quo(x^2+1).is_zero() False
-
quo
(I, names=None)¶ Quotient of a ring by a two-sided ideal.
NOTE:
This is a synonym for
quotient()
.EXAMPLE:
sage: MS = MatrixSpace(QQ,2) sage: I = MS*MS.gens()*MS
MS
is not an instance ofRing
.However it is an instance of the parent class of the category of rings. The quotient method is inherited from there:
sage: isinstance(MS,sage.rings.ring.Ring) False sage: isinstance(MS,Rings().parent_class) True sage: MS.quo(I,names = ['a','b','c','d']) Quotient of Full MatrixSpace of 2 by 2 dense matrices over Rational Field by the ideal ( [1 0] [0 0], <BLANKLINE> [0 1] [0 0], <BLANKLINE> [0 0] [1 0], <BLANKLINE> [0 0] [0 1] )
-
quotient
(I, names=None)¶ Quotient of a ring by a two-sided ideal.
INPUT:
I
: A twosided ideal of this ring.names
: a list of strings to be used as names for the variables in the quotient ring.
EXAMPLES:
Usually, a ring inherits a method
sage.rings.ring.Ring.quotient()
. So, we need a bit of effort to make the following example work with the category framework:sage: F.<x,y,z> = FreeAlgebra(QQ) sage: from sage.rings.noncommutative_ideals import Ideal_nc sage: from itertools import product sage: class PowerIdeal(Ideal_nc): ....: def __init__(self, R, n): ....: self._power = n ....: Ideal_nc.__init__(self, R, [R.prod(m) for m in product(R.gens(), repeat=n)]) ....: def reduce(self, x): ....: R = self.ring() ....: return add([c*R(m) for m,c in x if len(m) < self._power], R(0)) ....: sage: I = PowerIdeal(F,3) sage: Q = Rings().parent_class.quotient(F, I); Q Quotient of Free Algebra on 3 generators (x, y, z) over Rational Field by the ideal (x^3, x^2*y, x^2*z, x*y*x, x*y^2, x*y*z, x*z*x, x*z*y, x*z^2, y*x^2, y*x*y, y*x*z, y^2*x, y^3, y^2*z, y*z*x, y*z*y, y*z^2, z*x^2, z*x*y, z*x*z, z*y*x, z*y^2, z*y*z, z^2*x, z^2*y, z^3) sage: Q.0 xbar sage: Q.1 ybar sage: Q.2 zbar sage: Q.0*Q.1 xbar*ybar sage: Q.0*Q.1*Q.0 0
-
quotient_ring
(I, names=None)¶ Quotient of a ring by a two-sided ideal.
NOTE:
This is a synonyme for
quotient()
.EXAMPLE:
sage: MS = MatrixSpace(QQ,2) sage: I = MS*MS.gens()*MS
MS
is not an instance ofRing
, but it is an instance of the parent class of the category of rings. The quotient method is inherited from there:sage: isinstance(MS,sage.rings.ring.Ring) False sage: isinstance(MS,Rings().parent_class) True sage: MS.quotient_ring(I,names = ['a','b','c','d']) Quotient of Full MatrixSpace of 2 by 2 dense matrices over Rational Field by the ideal ( [1 0] [0 0], <BLANKLINE> [0 1] [0 0], <BLANKLINE> [0 0] [1 0], <BLANKLINE> [0 0] [0 1] )
-
-
class
Rings.
SubcategoryMethods
¶ -
Division
()¶ Return the full subcategory of the division objects of
self
.A ring satisfies the division axiom if all non-zero elements have multiplicative inverses.
Note
This could be generalized to
MagmasAndAdditiveMagmas.Distributive.AdditiveUnital
.EXAMPLES:
sage: Rings().Division() Category of division rings sage: Rings().Commutative().Division() Category of fields
TESTS:
sage: TestSuite(Rings().Division()).run() sage: Algebras(QQ).Division.__module__ 'sage.categories.rings'
-
NoZeroDivisors
()¶ Return the full subcategory of the objects of
self
having no nonzero zero divisors.A zero divisor in a ring \(R\) is an element \(x \in R\) such that there exists a nonzero element \(y \in R\) such that \(x \cdot y = 0\) or \(y \cdot x = 0\) (see Wikipedia article Zero_divisor).
EXAMPLES:
sage: Rings().NoZeroDivisors() Category of domains
Note
This could be generalized to
MagmasAndAdditiveMagmas.Distributive.AdditiveUnital
.TESTS:
sage: TestSuite(Rings().NoZeroDivisors()).run() sage: Algebras(QQ).NoZeroDivisors.__module__ 'sage.categories.rings'
-