Changes between Version 2 and Version 3 of Ticket #6036


Ignore:
Timestamp:
05/14/09 06:47:28 (12 years ago)
Author:
klee
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6036 – Description

    v2 v3  
    1 The patch 12159.patch modifies the code in remove_from_tuple() in sage.rings.polynomial.multi_polynomial.pyx. The patch 12160.patch adds a testing example in the docstring.
     1This works:
     2
     3{{{
     4sage: R.<x,y>=PolynomialRing(QQ,2)
     5sage: a=x^2+x*y+y
     6sage: a.polynomial(x)
     7x^2 + y*x + y
     8
     9But this does not work:
     10
     11sage: R.<x,y>=PolynomialRing(GF(5),2)
     12sage: a=x^2+x*y+y
     13sage: a.polynomial(x)
     14Traceback (most recent call last):
     15...
     16TypeError: 'tuple' object cannot be interpreted as an index
     17}}}
     18
     19I traced this bug, and found that
     20
     21{{{
     22sage: B=QQ[x]
     23sage: print B({0:1,1:2})
     242*x + 1
     25sage: print B({(0,):1,(1,):2})
     262*x + 1
     27sage: B=GF(5)[x]
     28sage: print B({0:1,1:2})
     292*x + 1
     30sage: print B({(0,):1,(1,):2})
     31Traceback (most recent call last):
     32...
     33TypeError: 'tuple' object cannot be interpreted as an index
     34}}}
     35I think the second form is not acceptable. Then the function
     36remove_from_tuple() in sage.rings.polynomial.multi_polynomial.pyx
     37should be revised as it output (1,) from (1,2) for example.