human_math 0.1

Creator: bradpython12

Last updated:

Add to Cart

Description:

human math 0.1

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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.