Dealing with rationals in SymPy

Viewed 20
>>> Rational((0.5*1/2)/(0.5*1/2+0.2))
2501999792983609/4503599627370496

So I want this to give me a fraction of 5/9, is it possible to get that in python?

1 Answers

You can either use nsimplify instead of Rational or else use the limit_denominator on the Rational:

enter image description here

Related