#3865: Bug in conversion from gp elements to p-adics
----------------------------------+-----------------------------
Reporter: craigcitro | Owner: craigcitro
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.11
Component: interfaces | Resolution:
Keywords: | Merged in:
Authors: David Loeffler | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Dependencies:
Stopgaps: |
----------------------------------+-----------------------------
Changes (by {'newvalue': u'David Loeffler', 'oldvalue': ''}):
* status: new => needs_review
* author: => David Loeffler
* upstream: => N/A
Old description:
> David Loeffler ran into the following:
>
> {{{
> sage: v = gp.polrootspadic(x^2-2, 7, 20)[1]
>
> sage: R = Zp(7, 10, "capped-rel")
>
> sage: R(v)
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call
> last)
>
> /Users/craigcitro/<ipython console> in <module>()
>
> /Users/craigcitro/three-one/local/lib/python2.5/site-
> packages/sage/rings/padics/padic_generic.py in __call__(self, x, absprec,
> relprec)
> 82 Casts x into self. Uses the constructor of
> self._element_class.
> 83 """
> ---> 84 return self._element_class(self, x, absprec, relprec)
> 85
> 86 def _coerce_impl(self, x):
>
> /Users/craigcitro/padic_capped_relative_element.pyx in
> sage.rings.padics.padic_capped_relative_element.pAdicCappedRelativeElement.__init__
> (sage/rings/padics/padic_capped_relative_element.c:4872)()
>
> /Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__init__
> (sage/rings/rational.c:3767)()
>
> /Users/craigcitro/rational.pyx in
> sage.rings.rational.Rational.__set_value (sage/rings/rational.c:4567)()
>
> /Users/craigcitro/three-one/local/lib/python2.5/site-
> packages/sage/interfaces/expect.py in _rational_(self)
> 1393 def _rational_(self):
> 1394 import sage.rings.all
> -> 1395 return sage.rings.all.Rational(repr(self))
> 1396
> 1397 def name(self, new_name=None):
>
> /Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__init__
> (sage/rings/rational.c:3767)()
>
> /Users/craigcitro/rational.pyx in
> sage.rings.rational.Rational.__set_value (sage/rings/rational.c:4533)()
>
> TypeError: unable to convert 3 + 7 + 2*7^2 + 6*7^3 + 7^4 + 2*7^5 + 7^6 +
> 2*7^7 + 4*7^8 + 6*7^9 + 6*7^10 + 2*7^11 + 7^12 + 7^13 + 2*7^15 + 7^16 +
> 7^17 + 4*7^18 + 6*7^19 + O(7^20) to a rational
> }}}
>
> The trouble is that the code in the `__init__` method for
> `pAdicCappedRelativeElement`s only looks for Pari `gen` objects, not
> `GpElement`s. The fix should be trivial, but I'm going to look at it
> tomorrow.
New description:
David Loeffler ran into the following:
{{{
sage: v = gp.polrootspadic(x^2-2, 7, 20)[1]
sage: R = Zp(7, 10, "capped-rel")
sage: R(v)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/craigcitro/<ipython console> in <module>()
/Users/craigcitro/three-one/local/lib/python2.5/site-
packages/sage/rings/padics/padic_generic.py in __call__(self, x, absprec,
relprec)
82 Casts x into self. Uses the constructor of
self._element_class.
83 """
---> 84 return self._element_class(self, x, absprec, relprec)
85
86 def _coerce_impl(self, x):
/Users/craigcitro/padic_capped_relative_element.pyx in
sage.rings.padics.padic_capped_relative_element.pAdicCappedRelativeElement.__init__
(sage/rings/padics/padic_capped_relative_element.c:4872)()
/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__init__
(sage/rings/rational.c:3767)()
/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__set_value
(sage/rings/rational.c:4567)()
/Users/craigcitro/three-one/local/lib/python2.5/site-
packages/sage/interfaces/expect.py in _rational_(self)
1393 def _rational_(self):
1394 import sage.rings.all
-> 1395 return sage.rings.all.Rational(repr(self))
1396
1397 def name(self, new_name=None):
/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__init__
(sage/rings/rational.c:3767)()
/Users/craigcitro/rational.pyx in sage.rings.rational.Rational.__set_value
(sage/rings/rational.c:4533)()
TypeError: unable to convert 3 + 7 + 2*7^2 + 6*7^3 + 7^4 + 2*7^5 + 7^6 +
2*7^7 + 4*7^8 + 6*7^9 + 6*7^10 + 2*7^11 + 7^12 + 7^13 + 2*7^15 + 7^16 +
7^17 + 4*7^18 + 6*7^19 + O(7^20) to a rational
}}}
The trouble is that the code in the `__init__` method for
`pAdicCappedRelativeElement`s only looks for Pari `gen` objects, not
`GpElement`s. The fix should be trivial, but I'm going to look at it
tomorrow.
--
Comment:
... tock. :-)
--
Ticket URL: <http://trac.sagemath.org/ticket/3865#comment:2>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.