.. image:: http://www.repostatus.org/badges/latest/active.svg
:target: http://www.repostatus.org/#active
:alt: Project Status: Active — The project has reached a stable, usable
state and is being actively developed.
.. image:: https://github.com/jwodder/permutation/workflows/Test/badge.svg?branch=master
:target: https://github.com/jwodder/permutation/actions?workflow=Test
:alt: CI Status
.. image:: https://codecov.io/gh/jwodder/permutation/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jwodder/permutation
.. image:: https://img.shields.io/pypi/pyversions/permutation.svg
:target: https://pypi.org/project/permutation
.. image:: https://img.shields.io/github/license/jwodder/permutation.svg
:target: https://opensource.org/licenses/MIT
:alt: MIT License
`GitHub <https://github.com/jwodder/permutation>`_
| `PyPI <https://pypi.org/project/permutation>`_
| `Documentation <https://permutation.readthedocs.io>`_
| `Issues <https://github.com/jwodder/permutation/issues>`_
| `Changelog <https://github.com/jwodder/permutation/blob/master/CHANGELOG.md>`_
``permutation`` provides a ``Permutation`` class for representing `permutations
<https://en.wikipedia.org/wiki/Permutation>`_ of finitely many positive
integers in Python. Supported operations & properties include inverses, (group
theoretic) order, parity, composition/multiplication, cycle decomposition,
cycle notation, word representation, Lehmer codes, and, of course, use as a
callable on integers.
Installation
============
``permutation`` requires Python 3.7 or higher. Just use `pip
<https://pip.pypa.io>`_ for Python 3 (You have pip, right?) to install::
python3 -m pip install permutation
Examples
========
>>> from permutation import Permutation
>>> p = Permutation(2, 1, 4, 5, 3)
>>> p.to_cycles()
[(1, 2), (3, 4, 5)]
>>> print(p)
(1 2)(3 4 5)
>>> print(p.inverse())
(1 2)(3 5 4)
>>> p.degree
5
>>> p.order
6
>>> p.is_even
False
>>> p.lehmer(5)
27
>>> q = Permutation.cycle(1,2,3)
>>> print(p * q)
(2 4 5 3)
>>> print(q * p)
(1 3 4 5)
>>> for p in Permutation.group(3):
... print(p)
...
1
(1 2)
(2 3)
(1 3 2)
(1 2 3)
(1 3)
Raw data
{
"_id": null,
"home_page": "https://github.com/jwodder/permutation",
"name": "permutation",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "permutation,math,maths,mathematics,symmetric group,group theory",
"author": "John Thorvald Wodder II",
"author_email": "permutation@varonathe.org",
"download_url": "https://files.pythonhosted.org/packages/af/f6/e35627cd311d74413c0409296b4a4e7b48a745284f7765174acb080d0b36/permutation-0.4.0.tar.gz",
"platform": null,
"description": ".. image:: http://www.repostatus.org/badges/latest/active.svg\n :target: http://www.repostatus.org/#active\n :alt: Project Status: Active \u2014 The project has reached a stable, usable\n state and is being actively developed.\n\n.. image:: https://github.com/jwodder/permutation/workflows/Test/badge.svg?branch=master\n :target: https://github.com/jwodder/permutation/actions?workflow=Test\n :alt: CI Status\n\n.. image:: https://codecov.io/gh/jwodder/permutation/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/jwodder/permutation\n\n.. image:: https://img.shields.io/pypi/pyversions/permutation.svg\n :target: https://pypi.org/project/permutation\n\n.. image:: https://img.shields.io/github/license/jwodder/permutation.svg\n :target: https://opensource.org/licenses/MIT\n :alt: MIT License\n\n`GitHub <https://github.com/jwodder/permutation>`_\n| `PyPI <https://pypi.org/project/permutation>`_\n| `Documentation <https://permutation.readthedocs.io>`_\n| `Issues <https://github.com/jwodder/permutation/issues>`_\n| `Changelog <https://github.com/jwodder/permutation/blob/master/CHANGELOG.md>`_\n\n``permutation`` provides a ``Permutation`` class for representing `permutations\n<https://en.wikipedia.org/wiki/Permutation>`_ of finitely many positive\nintegers in Python. Supported operations & properties include inverses, (group\ntheoretic) order, parity, composition/multiplication, cycle decomposition,\ncycle notation, word representation, Lehmer codes, and, of course, use as a\ncallable on integers.\n\n\nInstallation\n============\n``permutation`` requires Python 3.7 or higher. Just use `pip\n<https://pip.pypa.io>`_ for Python 3 (You have pip, right?) to install::\n\n python3 -m pip install permutation\n\n\nExamples\n========\n\n>>> from permutation import Permutation\n>>> p = Permutation(2, 1, 4, 5, 3)\n>>> p.to_cycles()\n[(1, 2), (3, 4, 5)]\n>>> print(p)\n(1 2)(3 4 5)\n>>> print(p.inverse())\n(1 2)(3 5 4)\n>>> p.degree\n5\n>>> p.order\n6\n>>> p.is_even\nFalse\n>>> p.lehmer(5)\n27\n>>> q = Permutation.cycle(1,2,3)\n>>> print(p * q)\n(2 4 5 3)\n>>> print(q * p)\n(1 3 4 5)\n>>> for p in Permutation.group(3):\n... print(p)\n...\n1\n(1 2)\n(2 3)\n(1 3 2)\n(1 2 3)\n(1 3)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Permutations of finitely many positive integers",
"version": "0.4.0",
"project_urls": {
"Bug Tracker": "https://github.com/jwodder/permutation/issues",
"Documentation": "https://permutation.readthedocs.io",
"Homepage": "https://github.com/jwodder/permutation",
"Source Code": "https://github.com/jwodder/permutation"
},
"split_keywords": [
"permutation",
"math",
"maths",
"mathematics",
"symmetric group",
"group theory"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e10b9d0c5dea6e3f3904b409a2237404ff480a779e5bd99edc5304eaa0b2deb",
"md5": "95955e95ba732f81f68fc1ebfe240398",
"sha256": "43ef27c651153f16887b88b2398bb0cce6f8bc3068f1cfd3a31dc339fb2b5ac4"
},
"downloads": -1,
"filename": "permutation-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "95955e95ba732f81f68fc1ebfe240398",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 9420,
"upload_time": "2022-10-21T16:45:43",
"upload_time_iso_8601": "2022-10-21T16:45:43.893468Z",
"url": "https://files.pythonhosted.org/packages/0e/10/b9d0c5dea6e3f3904b409a2237404ff480a779e5bd99edc5304eaa0b2deb/permutation-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aff6e35627cd311d74413c0409296b4a4e7b48a745284f7765174acb080d0b36",
"md5": "b90d92011f97836022490346a474db1b",
"sha256": "1d33e2c90ea26c6d6dc85be14dfd78900bcce5d4c1b43363660a0b7f3bc05d32"
},
"downloads": -1,
"filename": "permutation-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "b90d92011f97836022490346a474db1b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 17502,
"upload_time": "2022-10-21T16:45:45",
"upload_time_iso_8601": "2022-10-21T16:45:45.400140Z",
"url": "https://files.pythonhosted.org/packages/af/f6/e35627cd311d74413c0409296b4a4e7b48a745284f7765174acb080d0b36/permutation-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-10-21 16:45:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jwodder",
"github_project": "permutation",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "permutation"
}