#5574: AlgebraicNumber.__pow__() does only rational exponents
---------------------------+-------------------------
Reporter: burcin | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-6.10
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
---------------------------+-------------------------
Changes (by rws):
* milestone: sage-6.4 => sage-6.10
* component: symbolics => algebra
* upstream: => N/A
Old description:
> Reported by Alex Raichev on sage-support:
>
> {{{
> sage: var('n',ns=1)
> n
> sage: (QQbar(2)^3)^n
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call
> last)
>
> <...>
> <...>/sage/rings/qqbar.pyc in __pow__(self, e)
> 2808 1
> 2809 """
> -> 2810 e = QQ._coerce_(e)
> 2811 n = e.numerator()
> 2812 d = e.denominator()
>
> <...>/sage/structure/parent_old.so in
> sage.structure.parent_old.Parent._coerce_ (sage/structure
> /parent_old.c:4031)()
>
> <...>/site-packages/sage/structure/parent.so in
> sage.structure.parent.Parent.coerce (sage/structure/parent.c:4185)()
>
> TypeError: no canonical coercion from New Symbolic Ring to Rational
> Field
> }}}
>
> Since pynac supports using arbitrary Sage objects as numeric objects in
> symbolic expressions, we should return a symbolic expression as a result
> of the above commands.
New description:
The first case reported by Alex Raichev on sage-support:
{{{
sage: var('n',ns=1)
n
sage: (QQbar(2)^3)^n
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
<...>
<...>/sage/rings/qqbar.pyc in __pow__(self, e)
2808 1
2809 """
-> 2810 e = QQ._coerce_(e)
2811 n = e.numerator()
2812 d = e.denominator()
<...>/sage/structure/parent_old.so in
sage.structure.parent_old.Parent._coerce_ (sage/structure
/parent_old.c:4031)()
<...>/site-packages/sage/structure/parent.so in
sage.structure.parent.Parent.coerce (sage/structure/parent.c:4185)()
TypeError: no canonical coercion from New Symbolic Ring to Rational
Field
also:
sage: (QQbar(2)^3)^1.
...
TypeError: no canonical coercion from Real Field with 53 bits of precision
to Rational Field
}}}
case 1: Since pynac supports using arbitrary Sage objects as numeric
objects in symbolic expressions, we should return a symbolic expression as
a result of the above commands.
case 2: just coerce to CDF
--
Comment:
This is a general shortcoming of `AlgebraicNumber.__pow__()`:
{{{
sage: (QQbar(2)^3)^1.
...
TypeError: no canonical coercion from Real Field with 53 bits of precision
to Rational Field
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/5574#comment:6>
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/d/optout.