#20490: Hash error with multivariate Laurent polynomial rings
-------------------------------------------------+-------------------------
       Reporter:  tscrim                         |        Owner:  tscrim
           Type:  defect                         |       Status:  new
       Priority:  critical                       |    Milestone:  sage-7.2
      Component:  misc                           |   Resolution:
       Keywords:  hash, multivariate Laurent     |    Merged in:
  polynomials                                    |    Reviewers:
        Authors:                                 |  Work issues:
Report Upstream:  N/A                            |       Commit:
         Branch:                                 |     Stopgaps:
   Dependencies:                                 |
-------------------------------------------------+-------------------------

Comment (by roed):

 The problem is that the hash function takes `elt._mon` into account:
 internally `elt` is represented as `ab/ab` while `R.one()` is represented
 as `1/1`.
 {{{
 sage: elt._fraction_pair()
 (a*b, a*b)
 sage: R.one()._fraction_pair()
 (1, 1)
 }}}
 The problem is solved in this case by manually calling `_normalize()`:
 {{{
 sage: elt._normalize()
 sage: elt._fraction_pair()
 (1, 1)
 sage: hash(elt) == hash(R.one())
 True
 }}}

 Writing hash functions is hard....

--
Ticket URL: <http://trac.sagemath.org/ticket/20490#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to