Re: Guessing "exact" values
- To: mathgroup at smc.vnet.net
- Subject: [mg76196] Re: Guessing "exact" values
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 17 May 2007 06:12:07 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f2eim0$t2f$1@smc.vnet.net>
Szabolcs wrote: > "Another computer algebra system" has a function, identify(), which > attempts to guess the exact expression that evaluates to a particular > numerical value. > > Example: > > In[1]:= N[3Pi+3/2,10] > > Out[1]= 10.92477796 > > > identify(10.92477796); > 3 > - + 3 Pi > 2 > > Is there a package with similar functionality for Mathematica? > > Szabolcs > Hi, The built-in function *Rationalize* and the add-on package NumberTheory`Rationalize` should be the closest equivalent to the function identify(). In[1]:= x = N[3*Pi + 3/2] Out[1]= 10.92477796076938 In[2]:= Rationalize[x, 0] Out[2]= 569958623/52171186 In[3]:= x - % Out[3]= 0. In[4]:= $Version Out[4]= "5.2 for Microsoft Windows (June 20, 2005)" HTH, Jean-Marc