Ask Your Question

Revision history [back]

permutations and transpositions

How a permutation be converted to a product of transpositions. inversions() gives an incorrect anser. P=Permutation([4, 8, 3, 1, 9, 2, 6, 7, 5]); P.inversions() [(1, 3),(1, 4),(1, 6),(2, 3),(2, 4),(2, 6),(2, 7),(2, 8),(2, 9),(3, 4),(3, 6),(5, 6),(5, 7),(5, 8),(5, 9),(7, 9),(8, 9)] I expect [(1,3),(1,4),(2,3),(2,4),(2,6),(2,7),(2,8),(3,6),(5,9)]

permutations and transpositions

How a permutation be converted to a product of transpositions. inversions() gives an incorrect anser. anser.

P=Permutation([4, 8, 3, 1, 9, 2, 6, 7, 5]); P.inversions()
[(1, 3),(1, 4),(1, 6),(2, 3),(2, 4),(2, 6),(2, 7),(2, 8),(2, 9),(3, 4),(3, 6),(5, 6),(5, 7),(5, 8),(5, 9),(7, 9),(8, 9)]

I expect [(1,3),(1,4),(2,3),(2,4),(2,6),(2,7),(2,8),(3,6),(5,9)]expect

[(1,3),(1,4),(2,3),(2,4),(2,6),(2,7),(2,8),(3,6),(5,9)]