#813: forced coercion vs. automatic coercion
------------------------+---------------------------------------------------
Reporter: nbruin | Owner: roed
Type: defect | Status: new
Priority: major | Milestone: sage-4.7.1
Component: coercion | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
------------------------+---------------------------------------------------
Changes (by SimonKing):
* component: basic arithmetic => coercion
Comment:
Meanwhile I believe that this is ''not'' invalid. Namely, we have the
following:
{{{
sage: from sage.categories.pushout import pushout
sage: pushout(QQ['x','y'],Frac(QQ['x'])['y'])
Univariate Polynomial Ring in y over Fraction Field of Univariate
Polynomial Ring in x over Rational Field
}}}
Hence, arithmetic between `QQ['x','y']` and `Frac(QQ['x'])['y']` should
work! But it doesn't:
{{{
sage: QQ['x','y'](1) + Frac(QQ['x'])['y'](1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/home/king/Projekte/MeatAxe/meataxe-2.2.4/<ipython console> in <module>()
/mnt/local/king/SAGE/sage-4.7.1.rc1/local/lib/python2.6/site-
packages/sage/structure/element.so in
sage.structure.element.RingElement.__add__
(sage/structure/element.c:11997)()
/mnt/local/king/SAGE/sage-4.7.1.rc1/local/lib/python2.6/site-
packages/sage/structure/coerce.so in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:7382)()
TypeError: unsupported operand parent(s) for '+': 'Multivariate Polynomial
Ring in x, y over Rational Field' and 'Univariate Polynomial Ring in y
over Fraction Field of Univariate Polynomial Ring in x over Rational
Field'
}}}
What is the problem? The conversion is fine:
{{{
sage: Frac(QQ['x'])['y'](QQ['x','y'](1))
1
}}}
But in fact there is no coercion into the pushout:
{{{
sage:
pushout(QQ['x','y'],Frac(QQ['x'])['y']).has_coerce_map_from(QQ['x','y'])
False
}}}
That's a bug, I think.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/813#comment:8>
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.