Re: Multiplying permutations
- To: mathgroup at smc.vnet.net
- Subject: [mg41778] Re: Multiplying permutations
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Thu, 5 Jun 2003 07:31:23 -0400 (EDT)
- Organization: University of Washington
- References: <bbhvu4$75u$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Wolfgang, My previous post was in error, the definition should have included an additional Ordering statement, as in p_\[CenterDot]q_ :=Ordering[Range[Length[p]][[Ordering[p]]][[Ordering[q]]]] Of course, Andrzej's contribution (using Permute from the Combinatorica package) is much simpler. On the other hand, if you want to avoid loading the Combinatorica package, an equally simple and a bit faster solution is the following: p_\[CenterDot]q_:=q[[p]] Carl Woll Physics Dept U of Washington "Dr. Wolfgang Hintze" <weh at snafu.de> wrote in message news:bbhvu4$75u$1 at smc.vnet.net... > Is there a simple command in Mathematica to multiply two permutations, > i.e. to carry out one after the other? > > I looked at the packages DiscreteMath`Permutations` and > DiscreteMath`Combinatorica` but couldn't find it. > > Example > > p = {3,1,2} mapping: 1->3, 2->1, 3->2 > q = {2,1,3} mapping: 1->2, 2->1, 3->3 > p.q = mappings (p first, then q) > [1-p->3-q->3, 2-p->1-q->2, 3-p->2-q->1] > = {3,2,1} > > Any help appreciated > > Wolfgang >