Sage has two similar classes of permutations with the names Standard permutations and Standard permutations of n. I wonder how to convert elements (of appropriate size) from one class to the other, and back.
Here an example of permutations from the two classes:
p = next(iter(Permutations(5)))
print('p =', p)
print(p.parent())
q = Permutation([1,2,3,4,5])
print('q =', q)
print(q.parent())
which prints
p = [1, 2, 3, 4, 5]
Standard permutations of 5
q = [1, 2, 3, 4, 5]
Standard permutations
How to add size to q
and how to remove one from p
most naturally? My solutions look ugly:
q_ = Permutations(len(q))(q)
p_ = Permutation(list(p))