If you have the list [1, 2, 3] and you permute positions 2 and 3, you
get [1, 3, 2], then permuting positions 1 and 2 gives [3, 1, 2].
>>> list(Permutation(1, 2)(2, 3))
[0, 3, 1, 2]
(the 0 is also included because Permutation assumes 0 indexing). Note
the distinction between the permutation, written in cycle notation,
and the permuted list. The permutation (1 2)(2 3) is equal to the
permutation (1 3 2)
>>> Permutation(1, 2)(2, 3)
Permutation(1, 3, 2)
This means the first element becomes the 3rd, the third element
becomes 2nd, and the second element becomes 1st.
The distinction is confusing because we use the numbers 0, 1, 2, 3 for
both. It may help to instead think of permuting the list ['a', 'b',
'c', 'd'].
>>> Permutation(1, 2)(2, 3)(['a', 'b', 'c', 'd'])
['a', 'd', 'b', 'c']
The right-to-left applies to the application of a permutation to a sequence:
>>> Permutation(2, 3)(['a', 'b', 'c', 'd'])
['a', 'b', 'd', 'c']
>>> Permutation(1, 2, size=4)(Permutation(2, 3)(['a', 'b', 'c', 'd']))
['a', 'd', 'b', 'c']
When Permutation is called with a single number, it returns what that
numeric index is mapped to
>>> Permutation(1, 2)(1)
2
>>> Permutation(1, 2)(2)
1
On Fri, Mar 12, 2021 at 11:15 AM Alexander Ness <
asn...@gmail.com> wrote:
>
> Hi Chris,
>
> The convention that I'm familiar with is that the notation (both cycle notation and the two-line notation) represents the exchange of elements, not positions. See for example
As I pointed out above, I believe this is really the source of the
confusion here. There is a distinction between permutation itself,
written in cycle notation, and the list itself. Unfortunately, the
examples use 1..n (or 0..n-1) for both, which can be confusing. It may
be easier to show the permutation of a list of Symbols, so that it's
clearer that a number represents the index in the permutation itself,
and a symbol represents a permuted element of a list.
I've read through the docs a couple of times, but I can't tell if they
are wrong or just confusing. Either way, I would suggest
disambiguation using the above suggestion or something similar. Using
the same notation (__call__) for both composition and application of a
permutation may also have been a mistake, but I'm not sure what we can
do about that.
Aaron Meurer
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
sympy+un...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/CABL__Ev9SUwgCsy4irD7gC5XCxQSCHD2FUwN7L%2BPjLNfsxerSA%40mail.gmail.com.