Skip to main content

Symbolic algebra light type

Project description

README

Saltype stands for Symbolic Algebra Light Type, and is also a common additive in food preparation, which makes the name fit in the palette of software developed by me. Salt (as NaCl) is also a substance that can be found in high quantities in nature. This can be seen in parallel to saltype being developed to obtain derivatives of large scale systems, well at least a couple of thousand variables.

For the detailed documentation, see here: https://saltype.readthedocs.io/en/latest/index.html

How do I get set up?

pip install saltype

There are no dependencies outside the standard python library to use saltype.

BTW: I first called this salt, then salty, and each time somebody else created another package on pypi with the same name. Now I'll try to upload this before it happens again.

Teaser

The core functionality is demonstrated by this very simple example:

from saltype import Leaf
from saltype.tools import Derivative

x = Leaf(3.0)
y = 3 * x**2 + 2*x + 1

dy_dx = Derivative([y], [x])[0, 0]
print(dy_dx.value)  # = 6 * x + 2 = 20

In applications, we use this package to generate and evaluate Jacobian matrices of O(10000). Then it takes typically O(10) seconds to generate the Jacobian and O(1) second to evaluate it in each iteration. Of course, our Jacobians are also sparse, with less than 50 non-zero elements per row.

For developing ...

sphinx is required to build the documentation, and pytest is handy to run the tests, though they also run on the stdlib unittest module.

To build the documentation from the repo, enter the gendoc directory and run

make html

As being generic functionality of sphinx, this should work on Linux, Wintendo and Mac.

There are a number of unit tests in the unittest directory. Run

Contribution guidelines

Well, let's first get a star on github, before we talk about somebody else being interested in taking this further. Honestly, for many purposes, casadi is a better choice here, but if you just need something lightweight, maybe on embedded systems, then this might actually be the niece for salttype.

Contributions in the shape of coding and suggestions are welcome. The issue tracker is open for that.

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

saltype-1.4.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

saltype-1.4-py3-none-any.whl (36.4 kB view details)

Uploaded Python 3

File details

Details for the file saltype-1.4.tar.gz.

File metadata

  • Download URL: saltype-1.4.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for saltype-1.4.tar.gz
Algorithm Hash digest
SHA256 f587cfc7f92a95e249cffa92972898d47d62c40b18e17bf4cee4f5492724252c
MD5 4fb4026d3be3ac95e6796ff43dbffecf
BLAKE2b-256 e93ed436073fde8fafaa165573c27bc64310162f749305363f34165a5df8eb0d

See more details on using hashes here.

File details

Details for the file saltype-1.4-py3-none-any.whl.

File metadata

  • Download URL: saltype-1.4-py3-none-any.whl
  • Upload date:
  • Size: 36.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.3

File hashes

Hashes for saltype-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d13b3f1d064674b273f430a2cfbad0c4b51cfe5b9aa63bef44df6b48352b68bb
MD5 3230396885aa53c5c93bdbfc550c1a52
BLAKE2b-256 1d5e0efb21aad7c9dc516b347eb884751bcc5c9862a5ab9d01ad9c4b9686d76f

See more details on using hashes here.

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