Skip to main content

Symbolic evaluation for engineering calculations — renders expression → numbers with units → result as LaTeX

Project description

symeval

Idea

The idea is to build something like handcalcs and Calcpad, but then for Python notebooks (marimo & jupyter) using sympy symbolic math expressions and pint quantities (value + unit) as a starting point, such that we can create Explorable Explanations in Python notebooks.

symeval adds two methods to a sympy expression that allows you to fill in pint quantities (value + unit). These methods are:

  • quant_evalf: evaluate a sympy expression using pint units. (I don't remember why exactly, but I decided to not use sympy quantities for some reason, I think because sympy quantities can't handle things like GPa at all or intuitively and because pint units can be rendered nicely using pint's formatter "~L". Could that be?) This is especially useful when you want to calculate the quantities of a new column in a dataframe in a unit-aware manner.
  • sym_evalf: evaluate a sympy expression using pint units and return the LaTeX expression of the filled in formula.

Shortly explain what's great about handcalcs, i.e. it's raison d'etre, here. Then shortly explain that it isn't great that it relys on Jupyter cell magic, i.e. what the disadvantages of Jupyter cell magic are (such as the inability to render variables when doing e.g. a = x1 where x1 was calculated in another cell).

Advantages of using sympy:

  • ability to use symbolic math with sympy before plugging in the numbers
  • ability to apply .evalf or .quant_evalf to a dataframe of values.

Inspiration

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

symeval-0.3.0.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.

symeval-0.3.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file symeval-0.3.0.tar.gz.

File metadata

  • Download URL: symeval-0.3.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for symeval-0.3.0.tar.gz
Algorithm Hash digest
SHA256 d45548857ed1f2c273d47cfceccaa410dd6524c391f9e1cec4938161a7689e8b
MD5 0942cb918ca1f5a63986d75bcfe0cf57
BLAKE2b-256 e7e3097a16ce5bc48d7049a7695e2ef8edfb761317bfcfdafbaa59a5126d619c

See more details on using hashes here.

File details

Details for the file symeval-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: symeval-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for symeval-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3253c048d619a29c885f5492650dbee98e2a0cacf10f61a4152a0bca69864e26
MD5 ffe76917b88986d31a61fea2a818b3a1
BLAKE2b-256 2bd0aaf4eff3768edabe84be3a6defc24c3ff6a808fadd131d03a950b113d8e5

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