Ask Your Question

Permutations indexed from zero

asked 2014-07-13 12:10:27 -0500

Is there an option to have permutations indexed from zero instead of one, in other words can we have permutations on the integers 0 to n-1 instead of permutations on the integers 1 to n. This would be useful since indexation for lists, tuples, and iterables in general is usually from zero. Indices for variable names of generators of various algebraic structures, such as multivariate polynomial rings, finitely presented groups, etc., also start from zero.

I saw that PermutationOptions lets you choose how to display permutations, and whether to multiply them from left to right or right to left, but found nothing about having indices starting from zero versus one.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-07-14 04:43:22 -0500

updated 2014-07-14 04:43:36 -0500

You may use the permutation in sage.groups instead of the one in sage.combinat. They can be defined on any domain (at least on recent enough versions of Sage):

sage: S = SymmetricGroup(['a','b','c','d'])
sage: s = S([('a','b'),('c','d')])
sage: s
sage: s('a')

in particular the domain can be {0, ..., v-1}.


edit flag offensive delete link more

answered 2014-07-14 00:57:41 -0500

The permutation code in Sage is suboptimal and needs a rewrite. The check for positive input was introduced as a workaround to make the code usable, see . There you can find that this check can be turned off via

sage: Permutation(range(5),check_input=False)
[0, 1, 2, 3, 4]

This is not recommended and will lead to other problems.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-07-13 12:10:27 -0500

Seen: 82 times

Last updated: Jul 14 '14