Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another coercion problem with QQbar #12746

Closed
loefflerd mannequin opened this issue Mar 25, 2012 · 7 comments
Closed

Another coercion problem with QQbar #12746

loefflerd mannequin opened this issue Mar 25, 2012 · 7 comments

Comments

@loefflerd
Copy link
Mannequin

loefflerd mannequin commented Mar 25, 2012

We had a ticket recently (#12665) for QQbar(zeta(7)). Amusingly, QQbar(zeta(6)) fails in a completely different way:

sage: QQbar(zeta(6))
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1327, 0))

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/storage/masiao/sage-5.0.beta10/devel/sage-main/<ipython console> in <module>()

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:7940)()

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3344)()

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (sage/structure/coerce_maps.c:3247)()

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/rings/qqbar.pyc in _element_constructor_(self, x)
    793             return AlgebraicNumber(x._descr)
    794         elif hasattr(x, '_algebraic_'):
--> 795             return x._algebraic_(QQbar)
    796         return AlgebraicNumber(x)
    797 

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._algebraic_ (sage/symbolic/expression.cpp:6286)()

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in algebraic(ex, field)
    830         0
    831     """
--> 832     return AlgebraicConverter(field)(ex)
    833 
    834 ##############

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex)
    212                 div = self.get_fake_div(ex)
    213                 return self.arithmetic(div, div.operator())
--> 214             return self.arithmetic(ex, operator)
    215         elif operator in relation_operators:
    216             return self.relation(ex, operator)

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in arithmetic(self, ex, operator)
    717                 return self.field(base**expt)
    718             else:
--> 719                 return reduce(operator, map(self, ex.operands()))
    720         except TypeError:
    721             if operator is _operator.pow:

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in __call__(self, ex)
    212                 div = self.get_fake_div(ex)
    213                 return self.arithmetic(div, div.operator())
--> 214             return self.arithmetic(ex, operator)
    215         elif operator in relation_operators:
    216             return self.relation(ex, operator)

/storage/masiao/sage-5.0.beta10/local/lib/python2.7/site-packages/sage/symbolic/expression_conversions.pyc in arithmetic(self, ex, operator)
    721             if operator is _operator.pow:
    722                 from sage.symbolic.constants import e, pi, I
--> 723                 base, expt = self._operands
    724                 if base == e and expt / (pi*I) in QQ:
    725                     return exp(expt)._algebraic_(self.field)

AttributeError: 'AlgebraicConverter' object has no attribute '_operands'

This is pretty minor -- the conversion is obviously absurd, and all that needs to be changed is to get it to return a more informative error message. (Amazing the bugs you can discover from a typo; when I typed QQbar(zeta(7)) it was a typo for QQbar.zeta(7) !)

Component: algebra

Author: Mike Hansen

Reviewer: Robert Bradshaw

Merged: sage-5.1.beta5

Issue created by migration from https://trac.sagemath.org/ticket/12746

@loefflerd loefflerd mannequin added this to the sage-5.1 milestone Mar 25, 2012
@loefflerd loefflerd mannequin added c: algebra labels Mar 25, 2012
@loefflerd loefflerd mannequin assigned aghitza Mar 25, 2012
@loefflerd

This comment has been minimized.

@mwhansen
Copy link
Contributor

Attachment: trac_12746.patch.gz

@mwhansen
Copy link
Contributor

Author: Mike Hansen

@robertwb
Copy link
Contributor

robertwb commented Jun 6, 2012

comment:3

Looks good to me.

@jdemeyer
Copy link

jdemeyer commented Jun 9, 2012

comment:4

Please fill in your real name in the Author / Reviewer fields.

@mwhansen
Copy link
Contributor

mwhansen commented Jun 9, 2012

Reviewer: Robert Bradshaw

@jdemeyer
Copy link

Merged: sage-5.1.beta5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants