Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 9 years ago

B r u n o gravatar image

First, as mentioned by John, "your" integer ring should be defined by

sage: Z = IntegerRing() # or Z = Integers() or Z = ZZ

Question 1: There is no direct way in SageMath to ask for "the second element of I" when I = Z.ideal(2). Actually, it is not clear at all what should be "the second element". What you can do is test whether a given element belongs to I or not, or find the generator (note that this generator is an integer):

sage: I = Z.ideal(2)
sage: 2 in I
True
sage: 3 in I
False
sage: I.gen()
2
sage: type(I.gen())
<type 'sage.rings.integer.Integer'>

There is no such type as "the type of elements of an ideal" or something approaching.

Question 2: I am not definitive on this question, but I do not think you can define 2Z/6Z in SageMath. It is isomorphic to Z/3Z that you can define.

One reason is that 2Z is not considered as a ring in SageMath, but only as an ideal:

sage: I in Rings
False
click to hide/show revision 2
No.2 Revision

First, as mentioned by John, "your" integer ring should be defined by

sage: Z = IntegerRing() # or Z = Integers() or Z = ZZ

Question 1: There is no direct way in SageMath to ask for "the second element of I" when I = Z.ideal(2). Actually, it is not clear at all what should be "the second element". What you can do is test whether a given element belongs to I or not, or find the generator (note that this generator is an integer):

sage: I = Z.ideal(2)
sage: 2 in I
True
sage: 3 in I
False
sage: I.gen()
2
sage: type(I.gen())
<type 'sage.rings.integer.Integer'>

There is no such type as "the type of elements of an ideal" or something approaching.

Question 2: I am not definitive on this question, but I do not think you can define 2Z/6Z in SageMath. It is isomorphic to Z/3Z that you can define.

One reason is that 2Z is not considered as a ring in SageMath, but only as an ideal:ideal of Z:

sage: I in Rings
False
sage: I in Ideals(Z)
True