On Thursday, August 29, 2013 12:54:02 PM UTC-4, Nils Bruin wrote: > > On Thursday, August 29, 2013 8:52:02 AM UTC-7, Simon King wrote: >> >> Hi Stefan, >> >> On 2013-08-29, Stefan <stefan...@gmail.com> wrote: >> > Actually, this is not quite true. reduce() is, by default, called >> > automatically for elements of exact rings at creation time. It will >> > correctly get rid of common factors, but it does not normalize the >> leading >> > coefficients: >> >> Bad. But of course, it is all only defined up to units. >> > > On the other hand, in a lot of cases there are ways of normalizing, such > as making the leading coefficient of the denominator monic. > > There are also many fields where there is no GCD, but a "denominator" can > still be uniquely defined: think number fields and function fields that are > a finite extension of a rational function field. > > I suspect avoiding normalization is only seemingly a saving: When you > start adding elements together, you'll quickly see things explode if you're > not normalizing fractions. > > Of course, keeping elements in product form can be a very large saving if > you really need to compute in the multiplicative group of the function > field, so there is room for using multiple internal representations of > elements. > > So I'd say: equip domains with an optional normalize_fraction routine that > normalizes a tuple (N,D) to (N',D') with a unique denominator D'. If that > method is available, use it (always!) in FractionField and make elements > hashable. >
I like this solution! Maybe I'll get around to working on it soon(ish). --Stefan -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.