permute.py

Permute

This is a class for permutation group.
Create element with 'normal' way.
For example,

  [考1,考2,考3,考4,考5]

(1:1 onto mapping(bijection), 1->考1, 2->考2, 3->考3, 4->考4, 5->考5.)

Initialize
Initialize with 'normal' list.

>>>pm=Permute([考1,考2,...,考n])
 

Example

>>>a=Permute([2,3,1,5,4])

Operation

==Equality
*Multiplication
/Division
**Powering

Multiplication with normal mapping way.
i.e. 考=[考1,考2,..,考n],而=[而1,而2,..,而n], 考*而 is mapping,而i->考i.

 

You can get 考i.

>>>a[3]
1

Methods

inverse()

Return inverse(-1 powering).

>>>a.inverse()
[3,1,2,5,4]

identity()

Return identity element(unit) of permutation group.

>>>a.identity()
[1,2,3,4,5]

numbering()

Return number of permutation element.
It is symmetrical arranging.

 

This is inductive definition for dimension.

If (n-1) dimension numbering of [考1,考2,...,考(n-2),考(n-1)] is k,
numbering of [考1,考2,...,考(n-2),考(n-1),n] is k and
numbering of [考1,考2,...,考(n-2),n,考(n-1)] is k+(n-1)! and so on.
(Goto 鰾午瞬及朿盒 鎔わ朿鎔蝸詭懍鎔わ濡)

>>>a.numbering()
28

grouporder()

Return group order(Cardinality) of permutation group.

>>>a.grouporder()
120

order()

Return element order.
GroupElement method faster than this for large dimension.

>>>a.order()
6

ToTranspose()

Return the ExPermute element with transpose(2-dimensional cyclic) type.
It is recursive program,and it takes more time than ToCyclic module.

>>>a.ToTranspose()
[(4,5)(1,3)(1,2)](5)

ToCyclic()

Return the ExPermute element.

>>>a.ToCyclic()
[(1,2,3)(4,5)](5)

sgn()

Return the sign of permutation group element.
It returns even permutation is 1,odd one is -1.

>>a.sgn()
-1

types()

Return cyclic type defined by each cyclic permutation element length.

>>>a.types()
'(2,3)type'

ToMatrix()

Return permutation matrix,A.
A[i,考i]=1,other A[k,j]=0.

>>>a.ToMatrix()
0 0 1 0 0
1 0 0 0 0
0 1 0 0 0
0 0 0 0 1
0 0 0 1 0

Last-modified: 2006-02-24 (嗯) 16:17:44