#15345: Laurent polynomial rings don't preserve coercion
-------------------------------------------------+-------------------------
Reporter: darij | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.13
Component: algebra | Resolution:
Keywords: laurent polynomials, | Merged in:
polynomials, coercion, categories | Reviewers:
Authors: | Work issues:
Report Upstream: N/A | Commit:
Branch: | Stopgaps:
Dependencies: |
-------------------------------------------------+-------------------------
Description changed by darij:
Old description:
> {{{
> sage: R = LaurentPolynomialRing(ZZ, 'x')
> sage: T = LaurentPolynomialRing(QQ, 'x')
> sage: R.gen() + T.gen()
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call
> last)
> <ipython-input-3-dac3b0b430b6> in <module>()
> ----> 1 R.gen() + T.gen()
>
> /home/darij/sage-5.13.beta0/local/lib/python2.7/site-
> packages/sage/structure/element.so in
> sage.structure.element.RingElement.__add__
> (sage/structure/element.c:13884)()
>
> /home/darij/sage-5.13.beta0/local/lib/python2.7/site-
> packages/sage/structure/coerce.so in
> sage.structure.coerce.CoercionModel_cache_maps.bin_op
> (sage/structure/coerce.c:8169)()
>
> TypeError: unsupported operand parent(s) for '+': 'Univariate Laurent
> Polynomial Ring in x over Integer Ring' and 'Univariate Laurent
> Polynomial Ring in x over Rational Field'
> }}}
> Compare with the more complicated:
> {{{
> sage: R = PolynomialRing(ZZ, 'x').fraction_field()
> sage: T = PolynomialRing(QQ, 'x').fraction_field()
> sage: R.gen() + T.gen()
> 2*x
> }}}
>
> CCing Travis on this because it's a pain the ass for #15311.
New description:
{{{
sage: R = LaurentPolynomialRing(ZZ, 'x')
sage: T = LaurentPolynomialRing(QQ, 'x')
sage: R.gen() + T.gen()
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
<ipython-input-3-dac3b0b430b6> in <module>()
----> 1 R.gen() + T.gen()
/home/darij/sage-5.13.beta0/local/lib/python2.7/site-
packages/sage/structure/element.so in
sage.structure.element.RingElement.__add__
(sage/structure/element.c:13884)()
/home/darij/sage-5.13.beta0/local/lib/python2.7/site-
packages/sage/structure/coerce.so in
sage.structure.coerce.CoercionModel_cache_maps.bin_op
(sage/structure/coerce.c:8169)()
TypeError: unsupported operand parent(s) for '+': 'Univariate Laurent
Polynomial Ring in x over Integer Ring' and 'Univariate Laurent Polynomial
Ring in x over Rational Field'
}}}
Compare with the more complicated:
{{{
sage: R = PolynomialRing(ZZ, 'x').fraction_field()
sage: T = PolynomialRing(QQ, 'x').fraction_field()
sage: R.gen() + T.gen()
2*x
}}}
--
--
Ticket URL: <http://trac.sagemath.org/ticket/15345#comment:1>
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.