Changes between Initial Version and Version 2 of Ticket #6036


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

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #6036

    • Property Summary changed from a bug in polynomial() to [with patch, needs review] a bug in polynomial() for PolynomialRing(GF(5),2)
    • Property Component changed from algebra to basic arithmetic
    • Property Milestone changed from sage-4.0 to sage-4.0.1
  • Ticket #6036 – Description

    initial v2  
    1 This works:
    2 
    3 {{{
    4 sage: R.<x,y>=PolynomialRing(QQ,2)
    5 sage: a=x^2+x*y+y
    6 sage: a.polynomial(x)
    7 x^2 + y*x + y
    8 }}}
    9 
    10 But this does not work:
    11 
    12 {{{
    13 sage: R.<x,y>=PolynomialRing(GF(5),2)
    14 sage: a=x^2+x*y+y
    15 sage: a.polynomial(x)
    16 Traceback (most recent call last):
    17 ...
    18 TypeError: 'tuple' object cannot be interpreted as an index
    19 }}}
    20 
    21 The bug is essentially in:
    22 {{{
    23 sage: B=QQ[x]
    24 sage: print B({0:1,1:2})
    25 2*x + 1
    26 sage: print B({(0,):1,(1,):2})
    27 2*x + 1
    28 sage: B=GF(5)[x]
    29 sage: print B({0:1,1:2})
    30 2*x + 1
    31 sage: print B({(0,):1,(1,):2})
    32 Traceback (most recent call last):
    33 ...
    34 TypeError: 'tuple' object cannot be interpreted as an index
    35 }}
    36 
    37 I think the second form is not acceptable. Then the function
    38 remove_from_tuple() in sage.rings.polynomial.multi_polynomial.pyx
    39 should be revised as it output (1,) from (1,2) for example
     1The 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.