#11673: is_unit not properly implemented for algebraic integers
-----------------------------+----------------------------------------------
   Reporter:  bober          |          Owner:  davidloeffler
       Type:  defect         |         Status:  needs_review 
   Priority:  major          |      Milestone:  sage-4.8     
  Component:  number fields  |       Keywords:               
Work_issues:                 |       Upstream:  N/A          
   Reviewer:                 |         Author:  Johan Bosman 
     Merged:                 |   Dependencies:  #12185       
-----------------------------+----------------------------------------------
Changes (by johanbosman):

  * status:  needs_work => needs_review


Old description:

> Here is an example:
> {{{
> sage: K.<a> = NumberField(x^2 - x - 1)
> sage: OK = K.ring_of_integers()
> sage: OK(13).is_unit() # should be false!
> True
> sage: OK(1/13)
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)
>
> /home/bober/<ipython console> in <module>()
>
> /home/bober/sage/local/lib/python2.6/site-
> packages/sage/structure/parent.so in
> sage.structure.parent.Parent.__call__ (sage/structure/parent.c:7102)()
>
> /home/bober/sage/local/lib/python2.6/site-
> packages/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3254)()
>
> /home/bober/sage/local/lib/python2.6/site-
> packages/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3157)()
>
> /home/bober/sage/local/lib/python2.6/site-
> packages/sage/rings/number_field/order.pyc in _element_constructor_(self,
> x)
>    1049         V, _, embedding = self._K.vector_space()
>    1050         if not embedding(x) in self._module_rep:
> -> 1051             raise TypeError, "Not an element of the order."
>    1052         return self._element_type(self, x)
>    1053
>
> TypeError: Not an element of the order.
> }}}
>
> This does not seem to be limited to quadratic fields.

New description:

 Here is an example:
 {{{
 sage: K.<a> = NumberField(x^2 - x - 1)
 sage: OK = K.ring_of_integers()
 sage: OK(13).is_unit() # should be false!
 True
 sage: OK(1/13)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/bober/<ipython console> in <module>()

 /home/bober/sage/local/lib/python2.6/site-
 packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
 (sage/structure/parent.c:7102)()

 /home/bober/sage/local/lib/python2.6/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (sage/structure/coerce_maps.c:3254)()

 /home/bober/sage/local/lib/python2.6/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (sage/structure/coerce_maps.c:3157)()

 /home/bober/sage/local/lib/python2.6/site-
 packages/sage/rings/number_field/order.pyc in _element_constructor_(self,
 x)
    1049         V, _, embedding = self._K.vector_space()
    1050         if not embedding(x) in self._module_rep:
 -> 1051             raise TypeError, "Not an element of the order."
    1052         return self._element_type(self, x)
    1053

 TypeError: Not an element of the order.
 }}}

 This does not seem to be limited to quadratic fields.

 Apply [attachment:11673.2.patch].

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11673#comment:5>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to