Ask Your Question
0

Permutations indexed from zero

asked 10 years ago

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.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 10 years ago

vdelecroix gravatar image

updated 10 years ago

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

Preview: (hide)
link
-1

answered 10 years ago

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.

Preview: (hide)
link

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: 10 years ago

Seen: 517 times

Last updated: Jul 14 '14