Ask Your Question

Rings, Ideals, Quotient Rings in Sage

asked 2015-10-14 02:38:47 -0600

DesperateUser gravatar image

Hi everybody. I am new to sage. I want to construct rings, ideals, and quotient rings. I used Z.IntegerRing() to generate the ring of integers.

Question 1: Then I used I = Z.ideal(2) to get the ideal generated by 2 (even numbers). Question: How can I display the Elements. E.g. I(2) does not work in order to display the second element of the ideal.

Question 2: To generate the quotientring Z/2Z i used S = Z.quotient_ring(I). What if I want to generate the quotientring 2Z/6Z ? S = I.quotient_ring(J) does not work (I = Z.ideal(2), J = Z.ideal(6).

Thanks for any help

edit retag flag offensive close merge delete


What is Z?

vdelecroix gravatar imagevdelecroix ( 2015-10-14 07:12:52 -0600 )edit

Z is my integer ring

DesperateUser gravatar imageDesperateUser ( 2015-10-14 07:22:37 -0600 )edit

Can you give it to me?

vdelecroix gravatar imagevdelecroix ( 2015-10-14 07:33:32 -0600 )edit

I think Z is defined as Z = IntegerRing(), not Z.IntegerRing().

John Palmieri gravatar imageJohn Palmieri ( 2015-10-14 10:33:37 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-10-14 11:54:34 -0600

B r u n o gravatar image

updated 2015-10-14 12:09:18 -0600

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
sage: 3 in I
sage: I.gen()
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 $2\mathbb Z/6\mathbb Z$ in SageMath. It is isomorphic to $\mathbb Z/3\mathbb Z$ that you can define.

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

sage: I in Rings
sage: I in Ideals(Z)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-10-14 02:38:47 -0600

Seen: 173 times

Last updated: Oct 14 '15