On Sun, Aug 26, 2012 at 8:01 PM, Aleksandar Makelov <[email protected]> wrote: > Hi all, > > can't we just make one or the other way of multiplication (L to R or R to L) > canonical for the combinatorics module, regardless of whether the > permutation is an array form or a cyclic form? After all, it's the same > mathematical object with a different representation. Moreover, it's > legitimate (and I think that this is a nice feature since it adds more > flexibility for handling permutations) to do something like this: >>>> Permutation([[0, 1],[2, 3]])*Permutation([0, 2, 1, 3]) (sorry if they >>>> commute... imagine they don't :) ) > Is it going to multiply from left to right or from right to left? >
This is L to R and if I try change that it lots of things break. That's my motivation to allow a DisjointCycle object that allows for a R to L parsing. And note that there is a difference between entering a permutation in terms of cycles where no cycles contain common elements [(1, 2),(4, 5)] and one where they do [(1, 2),(2, 3)]. The latter are currently disallowed by Permutation by could be entered (if I move that direction) as C(1, 2)*C(2, 3) where C is the DisjointCycle object. > I guess it'd be better to make g*h mean "first apply g, then h", since > that's how other CAS that handle permutations do it. According to David, this is not the case. e.g. in gap (1, 2)*(2, 3) gives a R to L multiplication of those cycles. > Currently, the * method > converts both permutations to array form and interprets g*h as "first apply > h, then g". Alas, it doesn't: a*b is computed as [a[i] for i in b] which means "use b to select from a" which means that b was applied first. If it were L to R it would be [b[i] for i in a] And if done in that form, lots of things break (as we might expect). Personally, L to R makes a lot of sense. When I worked out the polyhedron transformations I used a 2-permutation basis to work out the different permutations corresponding, for example, to rotation through a vertex. Say my basis was p0 and p1. I imagined that to get to the same place as a vertex rotation I would have to do p0 and p1 3 times so I wrote the permutation as p0*p1**3. This is interpreted in the normal L to R reading: do p0 once and p1 three times. /c -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
