Changes between Initial Version and Version 1 of Ticket #14772, comment 44


Ignore:
Timestamp:
07/19/13 17:44:54 (8 years ago)
Author:
darij
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14772, comment 44

    initial v1  
    33I'll look into the multisets issue, but as for now here is a fix for another bug:
    44{{{
    5 sage: Permutations(descents=[1,3,4])           
     5sage: Permutations(descents=[1,3,4]).list()
    66}}}
    77gave an error. It turns out that, lacking an n-value in the input, the code would automatically set n to be the maximum entry of the list {{{[1, 3, 4]}}} plus 1 (btw, that causes another bug when the list is empty; fixed as well), but whoever wrote that must have missed the fact that the positions start with 0 (so a presence of 3 in the list really means that the permutations will have a descent at 4, i. e., their value at 4 will be larger than their value at 5), so the "correct" n would be the maximum entry of the list {{{[1, 3, 4]}}} plus 2. I think this is a completely stupid convention to make, and the syntax (giving the set of descents as a list without the n, having Sage automatically choose the n) should not be supported (no doctests in permutation.py use this syntax). Note that it only allows constructing permutations where the penultimate position is a descent; all the others require the long syntax with the n given! Also, it is misleading, because {{{descents=[1,3,4]}}} sounds like it should give the permutations with descent composition {{{[1,3,4]}}}, but the role of {{{[1,3,4]}}} here is absolutely not that of a composition.