https://github.com/innovativeinventor/groups
Representing groups as systems of rewrite rules and calculating various properties thereof
https://github.com/innovativeinventor/groups
Last synced: about 2 months ago
JSON representation
Representing groups as systems of rewrite rules and calculating various properties thereof
- Host: GitHub
- URL: https://github.com/innovativeinventor/groups
- Owner: InnovativeInventor
- Created: 2021-02-26T02:44:15.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-02T23:54:44.000Z (over 5 years ago)
- Last Synced: 2025-02-26T14:45:21.963Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Groups
[](https://github.com/InnovativeInventor/groups/actions/workflows/test-lint.yaml)
Representing certain kinds of finite groups in terms of generators and rewrite rules.
Work in progress.
This is probably not the best way to represent groups, but whatever.
Contributions are welcome.
## Example (D_16)
The group `D_16` can be represented like so
```
a^2 = e
b^8 = e
ba = ab^7
```
``` python
from groups import AbstractGroup
group = AbstractGroup({"a": 2, "b": 8}, {(("b", 1), ("a", 1)): (("a", 1), ("b", 7))}) # default group
```
where each element is represented as a list of tuples containing the generator, followed by the power of the generator.
To enumerate all the elements in the group you can then do
``` python
group.enumerate()
```
To multiply particular elements together you can do
``` python
group.multiply(term_1, term_2)
```
To normalize/simplify an element to its simplest form you can do
``` python
group.normalize(term_1)
```
To get the inverse of an element, you can do
``` python
group.inverse(term_1)
```
Voilà -- some basic group stuff!
More basic group operations (subgroups, conjugacy classes, normal subgroups, etc.) are used in [`examples/d16.py`](/examples/d16.py).
Tests are in [`groups/test_groups.py`](groups/test_groups.py).