Skip to content

pishleback/Algebraeon-Python

Repository files navigation

Algebraeon (Python Module)

Algebraeon is a computational algebra system (CAS) written purely in Rust. It implements algorithms for working with matrices, polynomials, algebraic numbers, factorizations, etc. The focus is on exact algebraic computations over approximate numerical solutions. Algebraeon is in early stages of development and the API subject to change. That said, I plan to only expose the more mature features via the Python API, so it should be more stable than the Rust API.

The Python library currently supports only a very small subset of the capabilities of the Rust library. Once it has been better fleshed out it will be the recommended way to use Algebraeon for people who care more about maths than software.

Examples

Factoring

from algebraeon import * # Algebraeon can factor numbers with much  # bigger prime factors than a naive algorithm is capable of. assert( Nat(706000565581575429997696139445280900).factor().powers() == {2: 2, 5: 2, 6988699669998001: 1, 1010203040506070809: 1} )

Further Examples

The user guide and tests folder have many more examples.

Development

One Time Setup

  1. cd into algebraeon.
  2. Run python3 -m venv .env to create a Python venv.
  3. Run source .env/bin/activate to enter the venv.
  4. Run pip install maturin. maturin is the tool used to build the Python module. Don't run pip install algebraeon; this venv is for installing the locally built version of algebraeon, which is handled by maturin.

Development

  1. cd into algebraeon.
  2. Run source .env/bin/activate to enter the venv.
  3. Run maturin develop or maturin develop --release to build the Algebraeon Python library into the venv.
  4. You can now run Python, and import algebraeon will import the version just built.

Running The Tests

To build the algebraeon Python module locally and run the tests in the User Guide against the local build:

  1. cd into run_tests.
  2. Run cargo run.

About

A Pythonic interface to the capabilities of Algebraeon

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors