Ask Your Question

Rings, Ideals, Quotient Rings in Sage

asked 2015-10-14 09:38:47 +0200

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 14:12:52 +0200 )edit

Z is my integer ring

DesperateUser gravatar imageDesperateUser ( 2015-10-14 14:22:37 +0200 )edit

Can you give it to me?

vdelecroix gravatar imagevdelecroix ( 2015-10-14 14:33:32 +0200 )edit

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

John Palmieri gravatar imageJohn Palmieri ( 2015-10-14 17:33:37 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-10-14 18:54:34 +0200

B r u n o gravatar image

updated 2015-10-14 19:09:18 +0200

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 09:38:47 +0200

Seen: 1,055 times

Last updated: Oct 14 '15