Re: Multiplying permutations
- To: mathgroup at smc.vnet.net
- Subject: [mg41747] Re: [mg41723] Multiplying permutations
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Wed, 4 Jun 2003 08:34:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On Tuesday, June 3, 2003, at 08:13 pm, Dr. Wolfgang Hintze wrote: > 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 > > > If you load in the DiscreteMath`Combinatorica` package then Permute[x,y] will give you the product of two permutations x and y. e.g. In[18]:= <<DiscreteMath`Combinatorica` In[22]:= Permute[{3,1,2},{2,1,3}] Out[22]= {1,3,2} In[23]:= Permute[{2,1,3},{3,1,2}] Out[23]= {3,2,1} Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/