Ask Your Question
0

Permutations indexed from zero

asked 2014-07-13 19:10:27 +0100

slelievre gravatar image

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
1

answered 2014-07-14 11:43:22 +0100

vdelecroix gravatar image

updated 2014-07-14 11:43:36 +0100

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
('a','b')('c','d')
sage: s('a')
'b'

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

Vincent

edit flag offensive delete link more
-1

answered 2014-07-14 07:57:41 +0100

rws gravatar image

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 http://trac.sagemath.org/ticket/13742 . 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

Stats

Asked: 2014-07-13 19:10:27 +0100

Seen: 472 times

Last updated: Jul 14 '14