#18942: Weird bug in roots of a polynomial in relative number field extension
------------------------------------------------+------------------------
       Reporter:  robharron                     |        Owner:
           Type:  defect                        |       Status:  new
       Priority:  major                         |    Milestone:  sage-6.8
      Component:  number fields                 |   Resolution:
       Keywords:  Relative number field, roots  |    Merged in:
        Authors:                                |    Reviewers:
Report Upstream:  N/A                           |  Work issues:
         Branch:                                |       Commit:
   Dependencies:                                |     Stopgaps:
------------------------------------------------+------------------------

Comment (by kedlaya):

 Replying to [comment:2 pbruin]:
 > In fact, in the above example we have
 > {{{
 > sage: K == L
 > True
 > }}}
 > which causes a cache lookup in `PolynomialRing` to return `K['x']` when
 given `L` as input.
 >
 > We should probably make number fields satisfy `K == L` if and only if `K
 is L`, i.e. make them inherit from `WithEqualityById`.  Doing this in the
 most naive way unfortunately leads to a number of doctest failures.

 In this example, we also have:
 {{{
 sage: hash(K) == hash(L)
 True
 }}}
 which is presumably why `PolynomialRing` is fooled. Digging into
 `src/sage/rings/number_field/number_field.py`:
 {{{
    def __hash__(self):
         r"""
         Compute the hash value of this number field.

         TESTS:

         Since there is a custom implementation of :meth:`__cmp`, we need a
         custom ``__hash__``. The number fields ``K`` and ``L`` in the
 following
         example used to have different hashes prior to :trac:`11670`::

             sage: R.<x> = QQ[]
             sage: R.<y> = QQ[]
             sage: K.<a> = NumberField(x^2+1)
             sage: L.<a> = NumberField(y^2+1)
             sage: K == L
             True
             sage: hash(K) == hash(L)
             True

         """
         return hash((self.variable_name(), self.base_field(),
 tuple(self.__polynomial)))
 }}}
 It appears that `self.__polynomial` is the absolute defining polynomial,
 not the relative one. I'm guessing this was done on purpose to fix some
 other problem, judging from this byline:
 {{{
 - Julian Rueth (2014-04-03): absolute number fields are unique parents
 }}}
 It might be worth trying to replace `self.__polynomial` with something
 like `self.relative_polynomial()` to see how much doctest breakage
 results.

--
Ticket URL: <http://trac.sagemath.org/ticket/18942#comment:4>
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