Hey everyone,

> Here's how you can get an infinite loop in two lines with Permutation. 
> > 
> > sage: p = 
> > 
> Permutation([(1,10,11,13,9,3,16,0,22),(8,2,15,18,24,26,20,21,4),(5,6,17,12,25,7,23,14,19)])
>  
>
> > sage: p.to_cycles() 
> > 
> > Of course it has to be because my permutation goes from 0 to n-1 while 
> the 
> > code expects 1-n. 
> > 
> > It is all very nice. Now, if the code does not work, we should just 
> refuse 
> > to build the corresponding permutations, and say it only works with 
> > integers. Otherwise it has to be fixed quicjky or all this code is 
> totally 
> > useless. 
>
> An other nice feature 
> {{{ 
> sage: Permutation([-1,1]) 
> [-1, 1] 
> sage: Permutation([-1,1]).to_cycles() 
> [(1, -1, False)] 
> }}} 
>

For this issue, I started work on cleaning up the input for permutations 
(there's 3 different trac tickets on this: #8392, #8918, #9831!), but have 
currently stalled. I was planning on getting back to this during the sage 
days at ICERM in February. There's a partial patch called 
trac_8392-check_permutation-ts.patch in the queue. I can get back on this 
now if desired. (Feel free to rebase this or let me know I need to rebase.)
 

>
> > By the way : is there any r&%$&$&$&%$ reason why Permutations (with a 
> > terminal s) does not contain Permutation object but LISTS ? 
> > 
> > sage: list(Permutations(["a","b","c"])) 
> > [['a', 'b', 'c'], ['a', 'c', 'b'], ['b', 'a', 'c'], ['b', 'c', 'a'], 
> ['c', 
> > 'a', 'b'], ['c', 'b', 'a']] 
> > sage: map(type,list(Permutations(["a","b","c"]))) 
> > [<type 'list'>, <type 'list'>, <type 'list'>, <type 'list'>, <type 
> 'list'>, 
> > <type 'list'>] 
>
> Permutations are the possible permutations of a (multi)set and should 
> not be considered as bijection (as the permutations in the python 
> library itertools). In particular, the following does work 
> {{{ 
> sage: Permutations('aabb').list() 
> [['a', 'a', 'b', 'b'], ['a', 'b', 'a', 'b'], ['a', 'b', 'b', 'a'], 
> ['b', 'a', 'a', 'b'], ['b', 'a', 'b', 'a'], ['b', 'b', 'a', 'a']] 
> }}} 
> In particular, the parent Permutations does *not* contains 
> Permutation. A bit confusing, but I think that's it! 
>
> > I know, it would be slower otherwise. But it is bad code. This kind of 
> > things should be done with an optional flag if you need it. 
>
> +1 
>

I completely agree.

Best,
Travis

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sage-combinat-devel/-/wyIIkS-zJ4oJ.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to