#19538: Fix LaurentPolynomialRing coercion issues
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  etn40ff                |       Status:  needs_review
           Type:         |    Milestone:  sage-6.10
  defect                 |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  algebra                |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  76ac4339b195762106d406516400f8468de844ef
  Salvatore Stella       |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/etn40ff/19358        |
   Dependencies:         |
-------------------------+-------------------------------------------------
Description changed by etn40ff:

Old description:

> `LaurentPolynomialRing` has some issues when trying to compare elements
> from different rings:
>
> {{{
> sage: L = LaurentPolynomialRing(ZZ, 'x0,x1,x2,y0,y1,y2')
> sage: P = LaurentPolynomialRing(ZZ, 'y0,y1,y2')
> sage: P.inject_variables()
> Defining y0, y1, y2
> sage: y0 in L
> False
> }}}
>
> This patch should fix them. In the process it also changes this somewhat
> weird behaviour:
>
> {{{
> sage: L = LaurentPolynomialRing(ZZ, 'x', 4)
> sage: R = LaurentPolynomialRing(ZZ, 'x3,x2,t,s')
> sage: R.inject_variables()
> Defining x3, x2, t, s
> sage: L(x3)
> x0
> sage: L(t)
> x2
> }}}
>
> NOTE: This behaviour still survives in `PolynomialRing`

New description:

 `LaurentPolynomialRing` has some issues when trying to compare elements
 from different rings:

 {{{
 sage: L1 = LaurentPolynomialRing(ZZ, 'x0,x1,x2,y0,y1,y2')
 sage: L2 = LaurentPolynomialRing(ZZ, 'y0,y1,y2')
 sage: L2.gen(0) in L1
 False
 sage: L1(L2.gen(0))
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 ...
 TypeError: tuple key must have same length as ngens
 }}}

 The corresponding code for `PolynomialRing` yields
 {{{
 sage: P1 = PolynomialRing(ZZ, 'x0,x1,x2,y0,y1,y2')
 sage: P2 = PolynomialRing(ZZ, 'y0,y1,y2')
 sage: P2.gen(0) in P1
 True
 sage: P1(P2.gen(0))
 y0
 }}}


 This patch should fix them. In the process it also changes this somewhat
 weird behaviour:

 {{{
 sage: L = LaurentPolynomialRing(ZZ, 'x', 4)
 sage: R = LaurentPolynomialRing(ZZ, 'x3,x2,t,s')
 sage: R.inject_variables()
 Defining x3, x2, t, s
 sage: L(x3)
 x0
 sage: L(t)
 x2
 }}}

 NOTE: This behaviour still survives in `PolynomialRing`

--

--
Ticket URL: <http://trac.sagemath.org/ticket/19538#comment:14>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to