Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: Re: Compatibility woes
  • Next by Date: Re: Hole/Disk function
  • Previous by thread: Re: Guessing "exact" values
  • Next by thread: Re: Guessing "exact" values