> 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? >
On a related note, two questions. 1) is_EuclideanDomainElement and friends are still imported into the global namespace via rings.all, but one gets a deprecation. (In fact, weirdly, they seem to be imported via structure.all as well?!? Are the ones in rings/ even needed?) Would this be another thing good to put in the 5.0 removal list (not of the files, but of the import)? See sage/all.py, where it was deprecated nearly two years ago. 2) What would a GaussianInteger inherit from (and would it have to be a .pyx file)? I note that cdef class IntegerRing_class(PrincipalIdealDomain): cdef class Integer(sage.structure.element.EuclideanDomainElement): but ZZ[i] and ZZ are both Euclidean Domains, not just PIDs. On the other hand, the construction above comes from class AbsoluteOrder(Order): so maybe that is the right thing to inherit from? - kcrisman -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
