How to work with the action of the symmetric group in Sage?
I wonder if there is a more natural or intuitive way to think about the action of an element of the symmetric group on the set it permutes. I will illustrate my concern with a simple example:
in: S=SymmetricGroup(3)
in: a=S((1,2))
in: b=S((2,3))
in: a*b
out: (1,3,2)
in: [a(b(i)) for i in range(1,4)]
out: [2, 3, 1]
in: [b(a(i)) for i in range(1,4)]
out: [3, 1, 2]
in: [(a*b)(i) for i in range(1,4)]
out: [3, 1, 2]
I understand that Sage is internally consistent here; my confusion is about how to reconcile this behavior with the usual mathematical notation for the permutation action.
What I have in mind intuitively is the following hypothetical:
in: [(i)(a*b) for i in range(1,4)] == [((i)a)b for i in range(1,4)]
out: True
where I would denote the right action of an element w on the index i by (i)w.
Maybe I am missing a standard or recommended approach in Sage for thinking about permutation actions in this situation, and I would appreciate any clarification.
A potentially related question.
First, you may be wrong about the "usual mathematical notation" - please check this MO discussion and in particular the answer of Brendan McKay there.
Second, the question you cited does provide a workaround via use of
Permutations.See also this discussion at sage-devel: https://groups.google.com/g/sage-deve...
Brendan’s explanation helps, and thinking in terms of $i^w$ clarifies the convention. My remaining confusion isn’t about left-to-right composition, but about notation in Sage.
In Sage, $w(i)$ denotes the action $i^w$, even though it looks like ordinary function application. I find that this notation makes me commit unintentional mistakes when switching viewpoints.
As a workaround, I’ve been explicitly separating the two by defining
so evaluation behaves the way I intuitively expect from function notation.
Ideally, I’d like to work only with something like Brendan’s notation $i^w$ in Sage and, if possible, block or avoid the $w(i)$ syntax altogether so I can’t make accidental mistakes. I don’t know whether Sage supports this.
I agree that $i^w$ might be a better notation for a right action than my hypothetical $(i)w$; I wasn’t aware that $i^w$ is the more standard notation for this kind of action. And Sage's notation $w(i)$ for a right action might cause mistakes. Thanks for letting me know.