Ok. The bug is in the canonicalize function of QuaternionAlgebra... the function does not care about 0. This is "very optimized" and "very wrong" ;-)
I will provide a ticket in a minute. Vincent 2014-10-04 20:01 UTC+02:00, Vincent Delecroix <20100.delecr...@gmail.com>: > And more precisely a lack of simplification at some point > > sage: w[0].denominator() > 2 > sage: z[0].denominator() > 4 > > 2014-10-04 19:57 UTC+02:00, Vincent Delecroix <20100.delecr...@gmail.com>: >> Hello Nathann, >> >> Seems to be the comparison in the number field... >> >> sage: z[0] >> -1/2 >> sage: w[0] >> -1/2 >> sage: z[0] == w[0] >> False >> sage: z[0].parent() >> Number Field in a with defining polynomial x^3 + x - 1 >> sage: w[0].parent() >> Number Field in a with defining polynomial x^3 + x - 1 >> >> Vincent >> >> 2014-10-04 19:44 UTC+02:00, Nathan Dunfield <nat...@dunfield.info>: >>> There's something wrong with comparison operators for elements of >>> QuaternionAlgebras defined over a number field. Here's a simple >>> example, >>> where first it gives the wrong answer and then, after doing some >>> arithmetic >>> >>> with the elements, a mix of right and wrong answers: >>> >>> sage: K = NumberField(x**3 + x - 1, 'a') >>> sage: D.<i,j,k> = QuaternionAlgebra(K, -1, -3) >>> sage: x = (i + j)/K(2) >>> sage: z = (-1 + (i + j) + k)/K(2) - x >>> sage: w = i * x >>> sage: w, z >>> (-1/2 + 1/2*k, -1/2 + 1/2*k) >>> sage: w == z >>> False >>> sage: z == w >>> False >>> sage: z - w >>> 0 >>> sage: z == w, w == w, z-w == 0 >>> (True, True, False) >>> >>> I looked in trac, but I didn't see this. Is this issue already known, >>> and, >>> >>> if so, is there a simple work-around? >>> >>> Thanks, >>> >>> Nathan >>> >>> -- >>> 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. >>> >> > -- 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.