Skip to main content

Structured math expression representation & parsing.

Project description

human_math

A mathematical expression parser

Example usage

>>> import human_math as hm                     # import module
>>> tree = hm.parse("2 - (-sin(3pi/2)) - 3.0")  # parse string (user input, etc.)
>>> tree
((2 - (-1 * sin(3 * (pi / 2)))) - 3)            # console representation uses parentheses everywhere to be strictly non-ambigious
>>> tree.evaluate()                             # evaluate the expression tree
-2                                              # nb: sin(3pi/2) = -1 so 2 - (-1) - 3 = -2

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

human_math-0.1.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

human_math-0.1-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page