On 29 April 2014 15:47, Volker Braun <[email protected]> wrote: > On Tuesday, April 29, 2014 3:35:55 PM UTC+1, John Cremona wrote: >> >> On 29 April 2014 15:16, Volker Braun <[email protected]> wrote: >> > s and t are not the same expression, so they have different hashes. We >> > break >> > Python by letting them compare equal. Hence the outcome of putting them >> > into >> > sets is undefined. In CPython: if the hash collides, you get one >> > element. If >> > the hash does not collide, you get two elements. >> >> That is a *very* unsatisfactory explanation for anyone actually >> wanting to use Sage to do mathematics. > > > I agree. > > Always putting things in canonical form will be slow (there is no hook for > "you are about to be put into a set") and/or not possible (fp group > elements).
The current code already divides by the gcd of numerator and denominator, which is surely the expensive part. It then checks to see if the denominator is a unit (i.e. non-zero constant) and if so divides numerator by that and replaces the denomionator by 1. What I am proposing is only a very small addition to that. I will open a ticket... John > > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
