|repostatus| |ci-status| |coverage| |pyversions| |license|
.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg
:target: https://www.repostatus.org/#active
:alt: Project Status: Active — The project has reached a stable, usable
state and is being actively developed.
.. |ci-status| image:: https://github.com/jwodder/permutation/actions/workflows/test.yml/badge.svg
:target: https://github.com/jwodder/permutation/actions/workflows/test.yml
:alt: CI Status
.. |coverage| image:: https://codecov.io/gh/jwodder/permutation/branch/master/graph/badge.svg
:target: https://codecov.io/gh/jwodder/permutation
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/permutation.svg
:target: https://pypi.org/project/permutation
.. |license| 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.8 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(1)
2
>>> p(3)
4
>>> p(42)
42
>>> 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": null,
"name": "permutation",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "group theory, math, mathematics, maths, permutation, symmetric group",
"author": null,
"author_email": "John Thorvald Wodder II <permutation@varonathe.org>",
"download_url": "https://files.pythonhosted.org/packages/f3/4c/b74d01cc99b8e2f13d77212e2b3a28966c70b09fd4963d5ad2e35a4df414/permutation-0.5.0.tar.gz",
"platform": null,
"description": "|repostatus| |ci-status| |coverage| |pyversions| |license|\n\n.. |repostatus| image:: https://www.repostatus.org/badges/latest/active.svg\n :target: https://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.. |ci-status| image:: https://github.com/jwodder/permutation/actions/workflows/test.yml/badge.svg\n :target: https://github.com/jwodder/permutation/actions/workflows/test.yml\n :alt: CI Status\n\n.. |coverage| image:: https://codecov.io/gh/jwodder/permutation/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/jwodder/permutation\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/permutation.svg\n :target: https://pypi.org/project/permutation\n\n.. |license| 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.8 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(1)\n2\n>>> p(3)\n4\n>>> p(42)\n42\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.5.0",
"project_urls": {
"Bug Tracker": "https://github.com/jwodder/permutation/issues",
"Documentation": "https://permutation.readthedocs.io",
"Source Code": "https://github.com/jwodder/permutation"
},
"split_keywords": [
"group theory",
" math",
" mathematics",
" maths",
" permutation",
" symmetric group"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e772f0fbf48e0bfe09a2451e92ea03fdd988d0be39c5508b063415a71b1fac4b",
"md5": "78846260f37741ed00635a36ac8e9319",
"sha256": "e73566dd6cf337b158a281eb318bb57dc29ceace3e952242b746c9270b3c0ad8"
},
"downloads": -1,
"filename": "permutation-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "78846260f37741ed00635a36ac8e9319",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 9414,
"upload_time": "2024-12-01T12:58:44",
"upload_time_iso_8601": "2024-12-01T12:58:44.091501Z",
"url": "https://files.pythonhosted.org/packages/e7/72/f0fbf48e0bfe09a2451e92ea03fdd988d0be39c5508b063415a71b1fac4b/permutation-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f34cb74d01cc99b8e2f13d77212e2b3a28966c70b09fd4963d5ad2e35a4df414",
"md5": "55f7223f110ab19bbcf118d4eebb9f73",
"sha256": "568b94f68a466f424f7d18f3d5c6dee2ffad8052d4ad9ae5caae7c9a6ee0fbd7"
},
"downloads": -1,
"filename": "permutation-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "55f7223f110ab19bbcf118d4eebb9f73",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 16453,
"upload_time": "2024-12-01T12:58:47",
"upload_time_iso_8601": "2024-12-01T12:58:47.615341Z",
"url": "https://files.pythonhosted.org/packages/f3/4c/b74d01cc99b8e2f13d77212e2b3a28966c70b09fd4963d5ad2e35a4df414/permutation-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-01 12:58:47",
"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"
}