Ask Your Question

Computations in the ring of integers of a number field

asked 2019-04-17 16:57:20 -0500

rogerl gravatar image

updated 2019-04-18 08:35:19 -0500

slelievre gravatar image

Suppose I have some number field $K$, with its ring of integers $O_K$ = K.ring_of_integers(). If $I$ is an ideal of $O_K$ (or, if $I$ is a fractional ideal of $K$), I'd like to be able to compute with the ring $O_K/I$. For example, I'd like to be able to ask how big that ring is.

K.<omega> = NumberField(x^2+x+1)
OK = K.ring_of_integers()
R.<a,b> = OK.quo(OK.ideal(9))

gives a NotImplementedError. (Even though cardinality shows up as one of the supported methods if I type R.??).

Or, again for example, I'd like to be able to determine the ring structure of $R$, or the structure of its group of units, but none of these methods seem to actually be supported.

The type of R is sage.rings.quotient_ring.QuotientRing_generic_with_category.

What am I missing?

edit retag flag offensive close merge delete


Methods that appear in tab completion are not always implemented.

FrédéricC gravatar imageFrédéricC ( 2019-04-18 02:46:39 -0500 )edit

@FredericC OK, but how do I do what I've asked to do?

rogerl gravatar imagerogerl ( 2019-04-18 09:11:40 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2019-04-18 12:46:28 -0500

slelievre gravatar image

Note that in this particular case, OK can be defined directly:

sage: E = EisensteinIntegers()
sage: E
Eisenstein Integers in Number Field in omega with defining polynomial x^2 + x + 1
sage: E.gens()
(1, omega)

If needed, define the generator:

sage: omega = E.gen(1)
sage: omega
sage: omega^2
-omega - 1

(We don't need it for what follows.)

Since the goal is to get information about an ideal, give it a name:

sage: J = E.ideal(9)
sage: J
sage: J
Fractional ideal (9)

Then it becomes easy to access information about this ideal.

Indeed, we can use the <TAB> key and type:

sage: J.<TAB>

to see all the methods that exist for J. Then it's a matter of trying out some of these methods with promising names, seeing what results we get, and reading their documentation.

Apply Euler phi to the ideal:

sage: J.euler_phi()

Get the documentation for euler_phi:

sage: J.euler_phi?
Signature:      J.euler_phi()
   Returns the Euler varphi-function of this integral ideal.

   This is the order of the multiplicative group of the quotient
   modulo the ideal.

   An error is raised if the ideal is not integral.


      sage: K.<i>=NumberField(x^2+1)
      sage: I = K.ideal(2+i)
      sage: [r for r in I.residues() if I.is_coprime(r)]
      [-2*i, -i, i, 2*i]
      sage: I.euler_phi()
      sage: J = I^3
      sage: J.euler_phi()
      sage: len([r for r in J.residues() if J.is_coprime(r)])
      sage: J = K.ideal(3-2*i)
      sage: I.is_coprime(J)
      sage: I.euler_phi()*J.euler_phi() == (I*J).euler_phi()
      sage: L.<b> = K.extension(x^2 - 7)
      sage: L.ideal(3).euler_phi()
Init docstring: Initialize self.  See help(type(self)) for accurate signature.
File:           /opt/s/sage/local/lib/python3.7/site-packages/sage/rings/number_field/
Type:           method

The following may also be of interest:

sage: J.idealstar()
Multiplicative Abelian group isomorphic to C6 x C3 x C3
sage: J.idealstar?

sage: J.residues()
sage: list(J.residues())
sage: len(J.residues())

sage: J.invertible_residues()
sage: list(J.invertible_residues())
sage: len(J.invertible_residues())

One take-away from this is that a lot of the information about the quotient modulo this ideal can be accessed using methods defined on the ideal, rather than on the quotient. Note how in all the above we never defined the quotient!

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: 2019-04-17 16:57:20 -0500

Seen: 75 times

Last updated: Apr 18