This is a class for permutation group element.
Create element with 'cyclic' way.
(σ1,σ2,...,σk)
(This is one-to-one mapping,σ1->σ2,σ2->σ3,..,σ(k-1)->σk,σk->σ1)
See Permute.
Initialize
Initialize with dimension and list of 'cyclic' tuple.>>>ep=ExPermute(dimension, [cyclic tuple,..])Or, you can specify key as list.
>>>ep=ExPermute(dimension, [key(cyclic tuple)], key_list)
Example
>>>Ep=ExPermute(5,[(1,2,3),(4,5)])
(This means multiplication of permutation, [2,3,1,4,5]*[1,2,3,5,4].)
>>>Epk=ExPermute(5,[('a','b')],['a','b','c','d','e'])
(This means ['a','b','c','d','e']->['b','a','c','d','e'])
You can use special key 0.
>>>sp=ExPermute(5,[(0,2),(3,4,1)],0)
(This means [0,1,2,3,4]->[2,3,0,4,1])
== | Equality |
* | Multiplication |
/ | Division |
** | Powering |
You can get σi.
>>>Ep[5] 4 >>>EPk['c'] 'c'
Set other key.
(other key order.)
>>>Epk.setKey(['a','c','b','d','e']) >>>Epk [('a', 'b')] <['a', 'c', 'b', 'd', 'e']>
(normal representation.)
>>>Epk.setKey([1,2,3,4,5]) >>>Epk [(1, 3)] <[1, 2, 3, 4, 5]>
Normal representation can be simply done by setKey().
Get data(don't return key).
>>>Ep.getData() [(1,2,3),(4,5)]
Return inverse(-1 powering).
>>>Ep.inverse() [(4,5),(3,2,1)](5)
Return group(PermGroup instance) belonged to self.
(In current version, moved to PermGroup as identity_c)
(In current version, moved to PermGroup as identity_c)
Return order.
>>>Ep.order() 6
Return the Permute element.
>>>Ep.ToNormal() [2,3,1,5,4]
Return the more simple cyclic element.
>>>Ep*Ep [(1,2,3),(4,5),(1,2,3),(4,5)](5) >>>(Ep*Ep).simplify() [(1,3,2)](5)
Permute list following with self permutation.
Warning: This permutation is independent on key (except dict type)
>>>Ep.permute(['a','b','c','d','e']) ['c', 'a', 'b', 'e', 'd']
sp type permutation is usuful for this method.(index starts 0)
>>>sp.permute(['a','b','c','d','e']) ['c', 'e', 'a', 'b', 'd']
You can use simply __call__ method.
>>>Ep(['a','b','c','d','e']) ['c', 'a', 'b', 'e', 'd']