Symmetria provides an intuitive, thorough, and comprehensive framework for interacting with the symmetric group and its elements.
Project description
Welcome to symmetria
Symmetria provides an intuitive, thorough, and comprehensive framework for interacting with the symmetric group and its elements.
- 📦 - installable via pip
- 🐍 - compatible with Python 3.9, 3.10, 3.11 and 3.12
- 👍 - intuitive API
- 🧮 - a lot of functionalities already implemented
- ✅ - 100% of test coverage
You can give a look at how to work with symmetria in the section quickstart, or you can directly visit the docs.
An interesting list of all the functionalities implemented by symmetria can be found here.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change, and give a look to the contribution guidelines.
Installation
Symmetria can be comfortably installed from PyPI using the command
pip install symmetria
or directly from the source GitHub code with
pip install git+https://github.com/VascoSch92/symmetria@xxx
where xxx
is the name of the branch or the tag you would like to install.
You can check that symmetria
was successfully installed by typing the command
symmetria --version
Quickstart
Let's get started with symmetria. First and foremost, we can import the Permutation
class from symmetria
. The Permutation class serves as the fundamental class for
working with elements of the symmetric group, representing permutations as
bijective maps. Additionally, you can utilize the Cycle
class and CycleDecomposition
class to work with cycle permutations and permutations represented as cycle
decompositions, respectively.
from symmetria import Permutation
permutation = Permutation(1, 3, 4, 5, 2, 6)
You can now represent your permutation in various formats:
print(permutation) # (1, 3, 4, 5, 2, 6)
print(permutation.cycle_notation()) # (1)(2 3 4 5)(6)
print(permutation.one_line_notation()) # 134526
Permutations can be compared between them and are easy to manipulate.
if permutation:
print("The permutation is different from the identity.")
if permutation == Permutation(1, 2, 3, 4, 5, 6):
print("The permutation is equal to the identity.")
if len(permutation) == 6:
print("The permutation acts on 6 elements.")
print(permutation * permutation)
Furthermore, we can decompose a permutation into its cycle decomposition
(CycleDecomposition
) and compute its order and support.
permutation.cycle_decomposition()
# returns CycleDecomposition(Cycle(1), Cycle(2, 3, 4, 5), Cycle(6))
permutation.order() # 4
permutation.support() # {2, 3, 4, 5}
permutation.is_derangement() # True
Overview
Statistics | |
---|---|
Repository | |
Issues | |
Pull Requests | |
Open Source | |
DOCS | |
CI/CD | |
Code | |
Downloads |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for symmetria-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f1578e21c513b478c2893f07497f6b0620268b6493887d02a8a8467fe8ecf4c |
|
MD5 | 6cea62bcdfee2d38d7f4df04a452da02 |
|
BLAKE2b-256 | e5b58081e84cb75d99290f08c6e19caf8f1d4c9b05222f76a33e1dd79d70a1a5 |