On Jun 16, 4:38 pm, kjell <kjell.wood...@gmail.com> wrote:
> I have a need to do some computations in the Eisenstein integers
> (modular exponentiations, cubic characters), and I'm wondering what
> the current support (or more to the point, the "right way") for
> handling them is in Sage. I did notice the reference at:
>
>    http://userpages.umbc.edu/~rcampbel/Computers/SAGE/numbthy.html
>
> which talks about treating them as a maximal order in Q(sqrt(-3)), but
> I haven't yet come across any other people using it in this way.
>

I'd appreciate the same answer with respect to Gaussian integers.
There, he says (which I believe is still true):

+++
SAGE currently has no convenient and complete way to work with
Gaussian integers.

A kludge which allows simple operations with the Gaussian integers is
to represent them as a formal polynomial ring quotient. This allows
you to add and multiply elements, but there is no concept of division,
modular reduction or factoring:

sage: ZZP = PolynomialRing(ZZ,'x'); x = ZZP.gen(); GI =
ZZP.quotient(x^2 + 1, 'i'); i=GI.gen()
sage: (i+2)*(3*i-5)
sage: (i+2)^10

A more exotic representation (but more appropriate for more general
quadratic number fields) is to represent the Gaussian Integers as the
maximal order in the number field Q(√-1).

sage: QFi.<sr1> = NumberField(x^2 + 1)
sage: GI = QFi.order(sr1)     # Create the Gaussian Integers
sage: i1 = QFi(sr1)
sage: (2+i1)^10
sage: 120 // (2-sr1)
sage: factor(GI.ideal(25+sr1))  # Factor as ideals
      # So 25 + sqrt(-1) = (1 + 4 sqrt(-1))(1 + sqrt(-1))(1 + 2
sqrt(-1))
(Fractional ideal (4*sr1 + 1)) * (Fractional ideal (sr1 + 1)) *
(Fractional ideal (2*sr1 + 1))

+++++

Would it be very difficult to implement a GaussianIntegers class which
used the symbolic I instead but otherwise used number fields behind
the curtain, or would that lead to too much confusion elsewhere?

I note that almost the same website as above points out that Mma has a
way to do at least basic things with this:

In[1]:= a = 3+6I; b = 2-I
In[2]:= n = a*b
In[3]:= PrimeQ[n,GaussianIntegers->True]
In[4]:= FactorInteger[n,GaussianIntegers->True]

Although the following Demonstration indicates that even in more
recent versions it's not totally obvious how to do cool things with
it:

http://demonstrations.wolfram.com/FactoringGaussianIntegers/

- kcrisman

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to