#18940: Polynomials ignore the step argument in __getitem__
-------------------------------------+-------------------------------------
       Reporter:  pbruin             |        Owner:
           Type:  defect             |       Status:  needs_info
       Priority:  major              |    Milestone:  sage-6.10
      Component:  algebra            |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Peter Bruin        |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/pbruin/18940-getitem_step        |  1c56779b3140d12fbe5d0973cdcad0ac9dbb8054
   Dependencies:  #19409             |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by pbruin):

 Replying to [comment:17 jdemeyer]:
 > Are you sure that the current behaviour is really what we want?
 > {{{
 > sage: pol = PolynomialRing(QQ, 'x')(range(10))
 > sage: pol
 > 9*x^9 + 8*x^8 + 7*x^7 + 6*x^6 + 5*x^5 + 4*x^4 + 3*x^3 + 2*x^2 + x
 > sage: pol[2:]
 > 9*x^9 + 8*x^8 + 7*x^7 + 6*x^6 + 5*x^5 + 4*x^4 + 3*x^3 + 2*x^2
 > }}}
 Yes.  The fact that polynomials are usually written with decreasing
 exponents is just a historical convention.  I think it is absolutely
 reasonable that `pol[2:]` should return the monomials of degree 2 and
 higher, whether as a polynomial or as a list.  And in fact
 {{{
 sage: list(pol)
 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
 }}}
 so doing `list(pol)[2:]` also extracts the coefficients of the monomials
 of degree at least 2.

 Similarly, in PARI, my experience is that `Vecrev` (which does the
 equivalent of `list` above) is more useful than `Vec` to extract the list
 of coefficients of a polynomial.

--
Ticket URL: <http://trac.sagemath.org/ticket/18940#comment:29>
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/d/optout.

Reply via email to