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
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 details)
Built Distribution
human_math-0.1-py3-none-any.whl
(13.1 kB
view details)
File details
Details for the file human_math-0.1.tar.gz
.
File metadata
- Download URL: human_math-0.1.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f84342c5ca2890e11b1c1e2d8f1d1776ff5e6e853289416c2ce48ddebfb638b1 |
|
MD5 | f556203484b7f98fc3779d2db917f1aa |
|
BLAKE2b-256 | 1eaf868ed4aecdf0150a2667bc0d5db82685a2d0671831d7475d20ad037c3a94 |
File details
Details for the file human_math-0.1-py3-none-any.whl
.
File metadata
- Download URL: human_math-0.1-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c69cbf7d5843adf5afcaf323ee40c3a50ded609f0089a9fdace5059450f2c8a4 |
|
MD5 | 5e913139afa60cde14e3d25565d9ef07 |
|
BLAKE2b-256 | a5c64728260d9e422ede7a5af4a740dc9fe0eff6712c1fbe6a3846c0be73c62d |