Metadata-Version: 2.1
Name: permutation
Version: 0.2.0
Summary: Permutations of finitely many positive integers
Home-page: https://github.com/jwodder/permutation
Author: John Thorvald Wodder II
Author-email: permutation@varonathe.org
License: MIT
Project-URL: Source Code, https://github.com/jwodder/permutation
Project-URL: Bug Tracker, https://github.com/jwodder/permutation/issues
Project-URL: Documentation, https://permutation.readthedocs.io
Project-URL: Say Thanks!, https://saythanks.io/to/jwodder
Keywords: permutation,math,maths,mathematics,symmetric group,group theory
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4
Description-Content-Type: text/x-rst

.. 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://travis-ci.org/jwodder/permutation.svg?branch=master
    :target: https://travis-ci.org/jwodder/permutation

.. 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

.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
    :target: https://saythanks.io/to/jwodder

`GitHub <https://github.com/jwodder/permutation>`_
| `PyPI <https://pypi.org/project/permutation>`_
| `Documentation <https://permutation.readthedocs.io>`_
| `Issues <https://github.com/jwodder/permutation/issues>`_

``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`` is written in pure Python with no dependencies.  Just use `pip
<https://pip.pypa.io>`_ (You have pip, right?) to install::

    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)


