The following input:

from sympy import Symbol
QQ(1)+Symbol('x')*QQ(2)

produces an error:

TypeError                                 Traceback (most recent call
last)

/Applications/sage/<ipython console> in <module>()

/Applications/sage/element.pyx in
sage.structure.element.ModuleElement.__add__ (sage/structure/element.c:
5606)()

/Applications/sage/coerce.pyx in
sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/
coerce.c:6288)()

TypeError: unsupported operand parent(s) for '+': 'Rational Field' and
'<class 'sympy.core.mul.Mul'>'


If the operands are reversed for either '+' or '*', i.e.:
Symbol('x')*QQ(2)+QQ(1)
or
QQ(1)+QQ(2)*Symbol('x')

the statement executes correctly.

That's the bug; if anyone knows of a workaround for now I'd like to
hear it.  My code builds up complicated expressions involving
rationals and symbols, and no matter how I reorder things, one of them
fails in this manner.  I know I can use 'var' instead of 'Symbol', but
I need non-commutative symbolic multiplication, which as I understand
var does not support.

David


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to