Hi all. I think there's a problem with the following: sage: K.<a> = NumberField(x^2 - x - 1) sage: I = K.ideal(2 * a - 1) sage: I2 = I.factor()[0][0] # I is a prime ideal, so its only factor is itself: sage: print I, I2, I == I2 Fractional ideal (2*a - 1) Fractional ideal (2*a - 1) True
# also, the ideals even print the same. # But the two hashes are different: sage: print I.__hash__(), I2.__hash__() -7493989779944505313 -6341068275337658337 # The hash is computed using I.pari_hnf().hash(), so let's look at that: sage: print I.pari_hnf(), I2.pari_hnf() [5, 2; 0, 1] [5, 2; 0, 1] sage: print I.pari_hnf() == I2.pari_hnf() True sage: print I.pari_hnf().__hash__(), I2.pari_hnf().__hash__() -7493989779944505313 -6341068275337658337 This looks rather strange. I and I2 also have the same types, and same parents. I eventually figured out the likely cause: sage: I.gens() (2*a - 1,) sage: I2.gens() (5, a + 2) So pari_hnf() is giving different answers for different bases, even though those answers look the same. Also, I can work around this with sage: I2 = K.ideal(I2.gens_reduced()) I'm not sure what the right fix for this is (assuming I'm not the only one that thinks something is wrong). Maybe the hash needs to be computed from a reduced generating set? I don't know if this will always work, but it does work in the example (note that a is a unit, so multiplying by a does not change the ideal) sage I3 = K.ideal( (I * a).gens_reduced()) even though the resulting ideals look different when printed: sage: I Fractional ideal (2*a - 1) sage: I3 Fractional ideal (a + 2) sage: print I == I3, I.__hash__() == I3.__hash__() True True -- To post to this group, send an email to [email protected] To unsubscribe from this group, send an email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org
