2021-02-23 09:35:23 +0200 | received badge | ● Popular Question (source) |
2019-03-21 13:13:02 +0200 | commented answer | Converting real numbers to rational format Thanks! I ended up just parsing the string in python and converting each number to a fraction there. It wasn't pretty but is solved the issue. |
2019-03-19 18:49:05 +0200 | asked a question | Converting real numbers to rational format I have a number of polynomials that are up to 200 terms long which I am copying and pasting into sage. They all have real-valued coefficients. When I try a and compute a Groebner basis I get the error: Is there a way to automatically approximate these coefficients as exact rationals? I could do it view convoluted string parsing in python but would prefer if there is a built in method in python. As a toy example, the following does not work (note the .1 in the first term) While if I represent the value as a fraction everything works fine. My actual use case has many terms, all of which have many more decimal places that this example so manually adjusting things would take a substantial amount of time. |