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.

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 tests folder has more examples.

Development

Running Tests

The Python codeblocks in the User Guide can executed as tests by the following steps:

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

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

No packages published

Contributors 2

  •  
  •