A Python package for supertropical algebra with tangible and ghost elements
Project description
SupertropicalPy
A comprehensive Python package for supertropical algebra, featuring tangible and ghost elements, matrix operations, and linear system solving using Cramer's rule.
🚀 Try it now! Click the "Open in Colab" badge above to run the interactive tutorial instantly in your browser - fast and free! No installation needed.
✨ Features
-
🎯 Tangible & Ghost Elements: Full support for both element types with automatic conversion
-
🧮 Supertropical Operations: Addition $\oplus$ defined by $a\oplus b=\max{a,b}$ (with ghost rules), and multiplication $\odot$ defined by $a\odot b=a+b$.
-
📐 Matrix Operations: Matrix multiplication, permanent (supertropical determinant), adjoint.
-
🔧 Linear System Solver: Cramer's rule implementation for solving $Ax = b$
-
🚀 NumPy Integration: Efficient computations using NumPy arrays
-
📚 Comprehensive Documentation: Full API reference, theory guide, and interactive tutorials
-
✅ Type Safety: Automatic type coercion and validation
📦 Installation
pip install supertropicalpy
Or install from source:
git clone https://github.com/TetewHeroez/supertropicalpy.git
cd supertropicalpy
pip install -e .
📖 Documentation
-
Full documentation is available at: GitHub Pages
-
Theory Guide: Mathematical background on supertropical algebra
-
Interactive Tutorial: Jupyter notebook with executable examples
-
API Reference: Complete API documentation
🧪 Running Tests
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
Run with coverage
pytest --cov=supertropical
📚 Building Documentation Locally
# Install docs dependencies
pip install -e ".[docs]"
# Build HTML docs
cd docs
sphinx-build -b html source build
pytest --cov=supertropical
📚 Building Documentation Locally
# Install docs dependencies
pip install -e ".[docs]"
# Build HTML docs
cd docs
sphinx-build -b html source build
# Or use make (on Unix/Mac/Windows with make installed)
cd docs
make html
🎓 Mathematical Background
Supertropical algebra extends tropical algebra with ghost elements:
Operations:
-
Addition: $a \oplus b = \max(a, b)$ with special ghost rules
-
Multiplication: $a \odot b = a + b$ (classical addition)
Elements:
-
Tangible: Regular elements (e.g., $5.0$)
-
Ghost: Elements marked with $\nu$ (e.g., $5.0\nu$)
-
Zero: $-\infty$ (additive identity)
-
One: $0$ (multiplicative identity)
Key Properties:
-
Matrix permanent replaces determinant
-
Cramer's rule works for nonsingular matrices (permanent is tangible)
-
Applications in optimization, algebraic geometry, and phylogenetics
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.```
👥 Authors
- Supertropical Team
🙏 Acknowledgments
- Based on research by Izhakian, Z., & Rowen, L. on supertropical algebra
📞 Contact
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file supertropicalpy-0.1.2.tar.gz.
File metadata
- Download URL: supertropicalpy-0.1.2.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8822fd72fa6cfb6a0122b8cc7d5181b9a657dd9f7aec305ce7ba7f6496e0b0b
|
|
| MD5 |
5fd04d6e6b27b382a9adf873e39e58cf
|
|
| BLAKE2b-256 |
bf50a8a99559e98a6bdb3764111fb517ce7322c28ffa7fbf9c7c6467ee0ae5e7
|
Provenance
The following attestation bundles were made for supertropicalpy-0.1.2.tar.gz:
Publisher:
publish-to-pypi.yml on TetewHeroez/supertropicalpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
supertropicalpy-0.1.2.tar.gz -
Subject digest:
e8822fd72fa6cfb6a0122b8cc7d5181b9a657dd9f7aec305ce7ba7f6496e0b0b - Sigstore transparency entry: 676627848
- Sigstore integration time:
-
Permalink:
TetewHeroez/supertropicalpy@9d235e413bd1dbe7cda4869fb2f8062c51a8315d -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/TetewHeroez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@9d235e413bd1dbe7cda4869fb2f8062c51a8315d -
Trigger Event:
release
-
Statement type:
File details
Details for the file supertropicalpy-0.1.2-py3-none-any.whl.
File metadata
- Download URL: supertropicalpy-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f022e6f41cca6f30570ccfca06b38bd7b93dc8c29e8befc557de94db5decf62f
|
|
| MD5 |
506ad11de8f3b5f2d02845c684a7c319
|
|
| BLAKE2b-256 |
7d4e5dcc4f6860b4df4d038f4bdab146d9ca33dd2f9c9a8deb9bfcf9e45d86d5
|
Provenance
The following attestation bundles were made for supertropicalpy-0.1.2-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on TetewHeroez/supertropicalpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
supertropicalpy-0.1.2-py3-none-any.whl -
Subject digest:
f022e6f41cca6f30570ccfca06b38bd7b93dc8c29e8befc557de94db5decf62f - Sigstore transparency entry: 676627851
- Sigstore integration time:
-
Permalink:
TetewHeroez/supertropicalpy@9d235e413bd1dbe7cda4869fb2f8062c51a8315d -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/TetewHeroez
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@9d235e413bd1dbe7cda4869fb2f8062c51a8315d -
Trigger Event:
release
-
Statement type: