Skip to main content

Python implementation of permutation groups

Project description

permgroups package

Python implementation of permutation groups is presented. Two classes are introduced: Perm for permutations, Group for permutation groups (everal versions).

The class Perm from the perms module is based on Python dictionaries and utilize cycle notation. The methods of calculation for the perm order, parity, ranking and unranking are given. A random permutation generation is also shown.

The class Group from the groups module is very simple and it is also based on dictionaries. It is mainly the presentation of the permutation groups interface with methods for the group order, subgroups (normalizer, centralizer, center, stabilizer), orbits, and several tests.

The class Group from the setgroups module is also simple and it is based on sets.

The class Group from the simsgroups module is advanced and it is bases on the Sims theory.

The project is moved from Google Code.

Download

To install an official release do

python3 -m pip install permgroups

To get the git version do

git clone https://github.com/ufkapano/permgroups.git

Usage

>>> from permgroups.perms import Perm
>>> from permgroups.groups import Group
>>> p = Perm()(0, 1, 2, 4)(3, 5)
>>> ~p
Perm()(0, 4, 2, 1)(3, 5)
>>> p.is_identity(), p.parity(), p.is_even(), p.sign()
(False, 0, True, 1)
>>> p.order(), pow(p, 4)
(4, Perm())
>>> Perm.random(10)
Perm()(0, 1, 4, 2, 7)(3, 9, 8)(5, 6)
>>> G = Group()
>>> G.insert(p)
>>> G.order()
4
>>> list(G.iterperms())
[Perm(), Perm()(0, 1, 2, 4)(3, 5), Perm()(0, 2)(1, 4), Perm()(0, 4, 2, 1)(3, 5)]
>>> Perm()(1, 4)(0, 2) in G, Perm()(0, 1, 2, 3) in G
(True, False)
>>> G.is_abelian()
True

References

[1] A. Kapanowski, Python for education: permutations. http://arxiv.org/abs/1307.7042 [draft]

[2] A. Kapanowski, The Python Papers 9, 3 (2014). Python for education: permutations. [final version] http://ojs.pythonpapers.org/index.php/tpp/article/view/258

Contributors

Andrzej Kapanowski (project leader)

Tomasz Gądek

EOF

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

permgroups-1.0.2.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

permgroups-1.0.2-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file permgroups-1.0.2.tar.gz.

File metadata

  • Download URL: permgroups-1.0.2.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.3

File hashes

Hashes for permgroups-1.0.2.tar.gz
Algorithm Hash digest
SHA256 1c15cd63930b05821cb02c0f753bf963d9106f7455e1ccb616ee61333d680e9a
MD5 f066fe9a21c8219c5bf88ddfcfb9938d
BLAKE2b-256 0f4b1cb6d5947b0abf47e6e385aa0eeaa2dd82df331476c8f5d21da34db0b86f

See more details on using hashes here.

File details

Details for the file permgroups-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: permgroups-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.3

File hashes

Hashes for permgroups-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3e7cd405f4aa5b78a11fff6b5b2afb89062b5e720e62bcf4b6c1179c90dce081
MD5 76d12c15b831affc33c94872325fd6d3
BLAKE2b-256 eab0081b759c1dcc2d7cab3b5d429a9755bee084f70c7f73e1fc31498182989c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page