Skip to main content

A Python package for supertropical algebra with tangible and ghost elements

Project description

SupertropicalPy

Python Version License Open In Colab

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

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supertropicalpy-0.1.2.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

supertropicalpy-0.1.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

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

Hashes for supertropicalpy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e8822fd72fa6cfb6a0122b8cc7d5181b9a657dd9f7aec305ce7ba7f6496e0b0b
MD5 5fd04d6e6b27b382a9adf873e39e58cf
BLAKE2b-256 bf50a8a99559e98a6bdb3764111fb517ce7322c28ffa7fbf9c7c6467ee0ae5e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for supertropicalpy-0.1.2.tar.gz:

Publisher: publish-to-pypi.yml on TetewHeroez/supertropicalpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file supertropicalpy-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for supertropicalpy-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f022e6f41cca6f30570ccfca06b38bd7b93dc8c29e8befc557de94db5decf62f
MD5 506ad11de8f3b5f2d02845c684a7c319
BLAKE2b-256 7d4e5dcc4f6860b4df4d038f4bdab146d9ca33dd2f9c9a8deb9bfcf9e45d86d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for supertropicalpy-0.1.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on TetewHeroez/supertropicalpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page