This is my first post here, I only started playing with programming two months ago.
My TI-89, and also Microsoft Mathematics, can divide, multiply, add fractions, etc. all without ever resorting to floating point numbers. I thought that such a module for doing math as exactly as possible must exist in python, but I can't find such a thing anywhere.
So, I've begun writing my own program to do this. So far, all I have is code that can factor the top and bottom halves of a fraction, and then simplify and return the fraction. From there, I will be able to write code that will add, subtract, multiply, and divide fractions and leave the numbers intact as exact. After that, I can just write logic gates that will execute the math in accord with orders of operation. I should note that all of this work is done in strings which are converted to numbers when necessary and then back to strings. Eventually, I hope to be able to add in math variables like x and y, and solving for variables
I'm not really sure what my question is beyond if anyone knows of such a module that can already do all of this. Also, does this sound like a useful tool to anyone? Any suggestions?
You should maybe look into the following modules:
If you are interested and able, you can volunteer to help the sympy team :)
I think you're looking for https://docs.python.org/3/library/decimal.html
The decimal module provides support for fast correctly-rounded decimal floating point arithmetic.
There are definitely other symbolic math libraries to do things like solve algebraic equations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With