#20555: descents for Permutations : cleanup
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  chapoton               |       Status:  needs_review
           Type:         |    Milestone:  sage-7.2
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:  Travis Scrimshaw, Christian Stump
  combinatorics          |  Work issues:
       Keywords:         |       Commit:
  permutation            |  8dc44205ed34a559df49aa24ddd14facf47a7b0e
        Authors:         |     Stopgaps:
  Frédéric Chapoton      |
Report Upstream:  N/A    |
         Branch:         |
  u/chapoton/20555       |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by stumpc5):

 Replying to [comment:26 tscrim]:
 > As a counterpoint, the (very) good reasons that descents start at 0 is
 because Python uses 0-based indexing:
 > {{{
 > sage: p = Permutation([5,3,2,4,1])
 > sage: p.descents()
 > [0, 1, 3]
 > sage: p[0]
 > 5
 > }}}
 > This would break this behavior with the current branch, and actually,
 thinking a bit more now about it, we should add some documentation to this
 point.
 > (I am pretty sure the position of the descent must correspond to the
 position of the larger value for the related math to work, but it's been
 awhile since I've thought about these things.)

 I do totally agree with the math part. But I am less convinced of the sage
 part:
 {{{
 sage: p = Permutation([5,3,2,4,1])
 sage: p[0]
 5
 }}}
 I would consider {{{p[0]}}} an implementation detail (as this might mean
 something in one-line notation, or the first cycle in cycle decomposition,
 or whatever else, depending on the implementation of permutations) and not
 a mathematically correct operation. In my eyes, the mathematically correct
 operation is
 {{{
 sage: p(1)
 5
 }}}
 which matches Frédéric's indexing.

--
Ticket URL: <http://trac.sagemath.org/ticket/20555#comment:28>
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