2009/9/3 javier <vengor...@gmail.com> > > Hi William, > > On Sep 3, 8:18 am, William Stein <wst...@gmail.com> wrote: > > I am not sure what something like "integers with I adjoined" is? > > > I guess that means the complex numbers of the fomr a + bI with a, b > integers, or Z[I] (the Gaussian Integers). Mathematica prides itself > to be able to apply primality tests, factorization algorithms and the > kind in this ring: > http://reference.wolfram.com/mathematica/ref/GaussianIntegers.html > > Maybe we should add an easy way of working with it, taking advantage > of Sage fast arithmetic for integers? >
Sage has the Gaussian integers, and I'm sure the basic arithmetic and functionality is as good or better than Mathematica already. sage: R.<I> = ZZ[sqrt(-1)]; R Order in Number Field in I with defining polynomial x^2 + 1 sage: a = 2 + 3*I sage: timeit('a*a') 625 loops, best of 3: 1.4 µs per loop sage: R.ideal(3) Fractional ideal (3) sage: R.ideal(3).factor() Fractional ideal (3) sage: R.ideal(5).factor() (Fractional ideal (-I - 2)) * (Fractional ideal (2*I + 1)) sage: R.class_group() Class group of order 1 with structure of Number Field in I with defining polynomial x^2 + 1 sage: P = R.ideal(11); P Fractional ideal (11) sage: P.is_prime() True sage: k = R.quotient(P,'a'); k Quotient of Maximal Order in Number Field in I with defining polynomial x^2 + 1 by the ideal (11) Of course Sage can do all the above sort of stuff with any number field. William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---