#11777: Coercion/printing problem with p-adics
-------------------------+--------------------------------------------------
   Reporter:  robharron  |          Owner:  roed                       
       Type:  defect     |         Status:  new                        
   Priority:  minor      |      Milestone:  sage-4.7.2                 
  Component:  padics     |       Keywords:  padics, repr_spec, repr_gen
Work_issues:             |       Upstream:  N/A                        
   Reviewer:             |         Author:                             
     Merged:             |   Dependencies:                             
-------------------------+--------------------------------------------------

Comment(by robharron):

 The following code:

   p = 53[[BR]] K.<zeta12> = !CyclotomicField(12)[[BR]]QQp = Qp(p,
 prec=1000000)[[BR]]print QQp.has_root_of_unity(3)[[BR]]QQq = Qq(p!^2,
 names='z', prec=1000000)[[BR]]print QQq.has_root_of_unity(3)[[BR]]print
 QQq(zeta12)[[BR]]print z!^2[[BR]]aaa=QQq(zeta12!^2)[[BR]]print
 aaa._ext_p_list(True)[[BR]]print aaa

 produces the output:

 {{{
 False
 True
 z + O(53^1000000)
 (4*z + 51) + (52*z + 52)*53 + (52*z + 52)*53^2 + (52*z + 52)*53^3 + (52*z
 + 52)*53^4 + (52*z + 52)*53^5 + (52*z + 52)*53^6 + (52*z + 52)*53^7 +
 (52*z + 52)*53^8 + (52*z + 52)*53^9 + (52*z + 52)*53^10 + (52*z +
 52)*53^11 + (52*z + 52)*53^12 + (52*z + 52)*53^13 + (52*z + 52)*53^14 +
 (52*z + 52)*53^15 + (52*z + 52)*53^16 + (52*z + 52)*53^17 + (52*z +
 52)*53^18 + (52*z + 52)*53^19 + O(53^20)
 []
 Traceback (most recent call last):    print QQq(zeta12)
   File "", line 1, in <module>

   File
 
"/private/var/folders/c+/c+SfSVUQGdqrYbVIA1yDLE+++TI/-Tmp-/tmpiPpw1C/___code___.py",
 line 13, in <module>
     exec compile(u'print aaa
   File "", line 1, in <module>

   File "sage_object.pyx", line 154, in
 sage.structure.sage_object.SageObject.__repr__
 (sage/structure/sage_object.c:1463)
   File "padic_generic_element.pyx", line 429, in
 sage.rings.padics.padic_generic_element.pAdicGenericElement._repr_
 (sage/rings/padics/padic_generic_element.c:5616)
   File "padic_printing.pyx", line 848, in
 sage.rings.padics.padic_printing.pAdicPrinter_class.repr_gen
 (sage/rings/padics/padic_printing.cpp:9279)
   File "padic_printing.pyx", line 952, in
 sage.rings.padics.padic_printing.pAdicPrinter_class._repr_gen
 (sage/rings/padics/padic_printing.cpp:10957)
   File "padic_printing.pyx", line 1092, in
 sage.rings.padics.padic_printing.pAdicPrinter_class._repr_spec
 (sage/rings/padics/padic_printing.cpp:13067)
 RuntimeError: repr_spec called on zero
 }}}
 It seems like there's a problem coercing zeta12!^2, since it should give
 z!^2 (note that if using 'bars' as print_mode, repr_gen raises an index
 out of bounds error as it attempts to access index 0 of
 aaa._ext_p_list(True). I don't know exactly what's going on, but at the
 very least shouldn't is_inexact_zero test for ._ext_p_list(True) returning
 an empty list?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11777#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 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