Skip to main content

Algebraic structures

Project description

Algebra

Build Coverage Status Latest Docs

Algebraic structures

Note: Algebra requires Python 3.6 or higher.

Installation

Before installing the package, please ensure that gcc and gfortran are available. On OS X, these are both installed with brew install gcc; users of Anaconda may want to instead consider conda install gcc. On Linux, gcc is most likely already available, and gfortran can be installed with apt-get install gfortran. Then simply

pip install algebra

Algebra

This package provides an algebra where the elements manipulated as expected, with basic algebraic simplifications done automatically.

As an example, let's create numbered elements.

from algebra import Element


class Numbered(Element):
    total = 0
    
    def __init__(self):
        self.num = Numbered.total
        Numbered.total += 1
    
    def render(self, formatter):
        return f'x{self.num}'

Then instances of Numbered can be manipulated as follows.

>>> x0 = Numbered()

>>> x1 = Numbered()

>>> x0 == x0
True

>>> a == b
False

>>> x0 + x1
x0 + x1

>>> x0 + x0
2 * x0

>>> x0 + x1 == x1 + x0
True

>>> x0 - x0
0

>>> 2 + x0
2 * 1 + x0

>>> (2 + x0) * x1
(2 * 1 + x0) * x1

>>> (2 + x0) * x1 * 0
0

Create Your Own Algebra

Coming soon.

Function Algebra

Coming soon.

Create Your Own Function Algebra

Coming soon.

Project details


Download files

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

Files for algebra, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size algebra-0.1.0.tar.gz (13.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page