Recognizing numbers with SymPy nsimplify
I was playing around with SymPy, a symbolic math package for Python, and ran across nsimplify. It takes a floating point number and tries to simplify it: as a fraction with a small denominator, square root of a small integer, an expression involving famous constants, etc. For example, suppose some calculation returned 4.242640687119286 and you
John D. Cook | Applied Mathematics Consulting