https://github.com/ajcr/transfinite
Transfinite ordinal arithmetic and factorisation up to epsilon-zero
https://github.com/ajcr/transfinite
arithmetic factorization ordinals python set-theory transfinite
Last synced: 8 months ago
JSON representation
Transfinite ordinal arithmetic and factorisation up to epsilon-zero
- Host: GitHub
- URL: https://github.com/ajcr/transfinite
- Owner: ajcr
- License: mit
- Created: 2015-10-07T21:36:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-03-22T22:00:09.000Z (almost 4 years ago)
- Last Synced: 2025-05-28T04:06:27.425Z (9 months ago)
- Topics: arithmetic, factorization, ordinals, python, set-theory, transfinite
- Language: Python
- Homepage:
- Size: 449 KB
- Stars: 14
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# transfinite
[](https://badge.fury.io/py/transfinite)
Transfinite [ordinal arithmetic](https://en.wikipedia.org/wiki/Ordinal_arithmetic) and factorisation up to the first [epsilon number](https://en.wikipedia.org/wiki/Epsilon_numbers_(mathematics)).
## Installation
Works with Python 3. Can be installed via pip using:
```
pip install transfinite
```
## Usage
For a basic introduction to ordinal arithmetic, look at Wikipedia or see the notebook [here](https://github.com/ajcr/transfinite/blob/master/notebooks/ordinal_arithmetic_basics.ipynb).
Here's a quick demonstration of the library in Jupyter's qtconsole (note that the variable `w` is the first transfinite number). First, some ordinal arithmetic:

The Ordinal class implements several methods which can be used to check properties of the ordinal:
- `Ordinal.is_limit()`, returns True if the ordinal is a [limit ordinal](https://en.wikipedia.org/wiki/Limit_ordinal).
- `Ordinal.is_successor()`, returns True if the ordinal is a [successor ordinal](https://en.wikipedia.org/wiki/Successor_ordinal).
- `Ordinal.is_gamma()`, returns True if the ordinal is [additively indecomposable](https://en.wikipedia.org/wiki/Additively_indecomposable_ordinal).
- `Ordinal.is_delta()`, returns True if the ordinal is [multiplicatively indecomposable](https://en.wikipedia.org/wiki/Additively_indecomposable_ordinal#Multiplicatively_indecomposable).
- `Ordinal.is_prime()`, returns True if the ordinal is prime.
[Ordinal factorisation](https://en.wikipedia.org/wiki/Ordinal_arithmetic#Factorization_into_primes) into prime ordinals is also implemented. Any composite ordinal `a` can be written as a product of two or more prime ordinals less than `a`:

Note that finite ordinals are not factorised using this method.