On Thu, Jun 12, 2014 at 10:19 AM, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > 2014-06-12 19:13 UTC+02:00, Robert Bradshaw <rober...@gmail.com>: >> On Thu, Jun 12, 2014 at 12:50 AM, Marc Mezzarobba <m...@mezzarobba.net> >> wrote: >> >>> But here is a similar example right from the Sage library (adapted from >>> http://wiki.sagemath.org/EqualityCoercion): >>> >>> sage: FiniteEnumeratedSet(GF(3)) >>> {0, 1, 2} >>> sage: add(FiniteEnumeratedSet([0,1,2])) >>> 0 >> >> Um, isn't that what you want? The sum of the elements of GF(p^e) for >> any odd prime is zero, which is a handy property. > > In two fresh Sage consoles > {{{ > sage: sum(FiniteEnumeratedSet([0,1,2])) > 3 > }}} > and > {{{ > sage: FiniteEnumeratedSet(GF(3)) > sage: sum(FiniteEnumeratedSet([0,1,2])) > 0 > }}} > > Because FiniteEnumeratedSet has a cache on the input!
Oh, ouch. +1 to using (parent(x), x) as the key. On Thu, Jun 12, 2014 at 12:51 PM, Jori Mantysalo <jori.mantys...@uta.fi> wrote: > Just a side note: > > On Thu, 12 Jun 2014, Robert Bradshaw wrote: > >> I'll second this. Are there *any* computer algebra systems (or >> programming languages for that matter) out there such that 4/2 != 2 != >> 2.0? Code would simply be too hard to write. > > Ada, I guess. It should give error if you try to compare integer with float. Ah, no wonder it's so widely used :). -- 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/d/optout.