Message Boards Message Boards

1
|
4963 Views
|
5 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Recognizing numbers

Python's sympy has a function called nsimplify that can do this: 
>>> from sympy import *
>>> nsimplify(4.242640687119286)
3*sqrt(2)
>>> nsimplify(pi, tolerance=1e-7)
exp(141/895 + sqrt(780631)/895)

It finds closed form approximations to numbers.  This looks like a lot of fun (and is potentially useful).
Original source: http://www.johndcook.com/blog/2013/04/30/recognizing-numbers/

So, can Mathematica do this?

Cheers,
Mike
POSTED BY: Michael Croucher
5 Replies
Thanks for the replies everyone emoticon
POSTED BY: Michael Croucher
Hello Mike,

One of the very first posts on Mathematica.SE was on a similar topic:

http://mathematica.stackexchange.com/questions/16/can-mathematica-propose-an-exact-value-based-on-an-approximate-one

Be sure to look at all answers (not just highly voted ones), and follow the links.  I asked a similar question on MathGroup a few years ago which also has interesting answers:

https://groups.google.com/d/msg/comp.soft-sys.math.mathematica/vq-MBdu51RI/lvNoiwHUPv8J

It was inspired by Maple's identify() function.
POSTED BY: Szabolcs Horvát
BTW the same function was used to recover some of the Ramanujan lost equations, as discussed in this latest Wolfram Blog: After 100 Years, Ramanujan Gap Filled . Below is the image from his "lost notebook" showing some incomplete equations. Click on the link or the image to read the full blog.
POSTED BY: Vitaliy Kaurov
Very nice. Thank you.
POSTED BY: Michael Croucher
Posted 11 years ago
Built in function
RootApproximant[4.242640687119286]
Out = 3*Sqrt[2]
works, and so does the Wolfram|Alpha query with quite a few results:

http://www.wolframalpha.com/input/?i=4.242640687119286 



Recent post at Wolfram Blog From Close to Perfect—A Triangle Problem  just discussed this very issue.

Hope that helps.
POSTED BY: Ed Pegg
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract