## Guessing "exact" values

Showing 1-13 of 13 messages
 Guessing "exact" values Szabolcs 5/16/07 2:25 AM "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                                   2Is there a package with similar functionality for Mathematica?Szabolcs Re: Guessing "exact" values dimitris 5/17/07 2:57 AM I think there is a package of Ted Ersek but I am not sure!Check www.wolfram.com and its archives.Dimitris=CF/=C7 Szabolcs =DD=E3=F1=E1=F8=E5: Re: Guessing "exact" values Murray Eisenberg 5/17/07 3:10 AM As I remember, at IMS'06 (Avignon) Stephen Wolfram (via remote link-up) played with a function to do just that.  Did I remember correctly?If so, I cannot recall the name of the function, so I don't know whether the function made it into 6.0.  The closest thing I can find is RootApproximant, but that doesn't seem to "recognize" an expression involving a transcendental number.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> -- Murray Eisenberg                     mur...@math.umass.eduMathematics & Statistics Dept.Lederle Graduate Research Tower      phone 413 549-1020 (H)University of Massachusetts                413 545-2859 (W)710 North Pleasant Street            fax   413 545-1801Amherst, MA 01003-9305 Re: Guessing "exact" values Jean-Marc Gulliet 5/17/07 3:35 AM 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.92477796076938In[2]:=Rationalize[x, 0]Out[2]=569958623/52171186In[3]:=x - %Out[3]=0.In[4]:=\$VersionOut[4]="5.2 for Microsoft Windows (June 20, 2005)"HTH,Jean-Marc Re: Guessing "exact" values Dana DeLouis 5/18/07 3:17 AM Hi.  This is not the best solution, but here's one idea I use.It's not the best solution, because I can't find a way to make Mathematica'sHyperlinks dynamic.In other words, once a hyperlink is made (Entered), it appears the addressis locked in stone.Maybe an expert can jump in and make this dynamic.A number we know nothing about...(??)n = 6.283185307179586Set the variable to something you would like to use.  For me...NumberToSearch = n; Re-Enter this equation (Shift Enter), and then click the link.Hyperlink["Click Here: Plouffe's Inverter",    StringReplace["http://bootes.math.uqam.ca/cgi-bin/ipcgi/lookup.\  pl?Submit=GO+&number=#&lookup_type=simple",      "#" :> ToString[Evaluate[NumberToSearch], InputForm,          NumberMarks -> False]]]The above click shows it might be 2 Pi.For your example, I took the full value:n=10.92477796076938This number didn't work.  Sometimes it won't work if the number is large.I don't know what "large" means, but the program really works withfractions.I decided to divided the number by 3.NumberToSearch = 10.92477796076938/33.641592653589793If I re-enter the Hyperlink, and click the link, the solution is Pi+1/2.Multiply by 3 to get your equation.Reference:  http://pi.lacim.uqam.ca/eng/-- HTH   :>)Dana DeLouisWindows XP & Mathematica 6.0 & Help files 5.2 :>~"Szabolcs" wrote in messagenews:f2eim0\$t2f\$1@smc.vnet.net...> "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> Re: Guessing "exact" values Dana DeLouis 5/18/07 3:30 AM As soon as I hit send, I thought of another way.  Don't know why I didn'tthink of this sooner.  I just modified mine to the following...RealLookup[NumberToSearch_Real] := Module[{s1 = "Click Here: Plouffe's Inverter on: ", s2 = ToString[NumberToSearch, InputForm, NumberMarks -> False], link = "http://bootes.math.uqam.ca/c\   gi-bin/ipcgi/lookup.pl?Submit=GO+&number=#&lookup_type=simple"}, Hyperlink[StringJoin[s1, s2], StringReplace[link, "#" :> s2]]]RealLookup[NumberToSearch_] :=    StringJoin["Number must be Real, not: ",      ToString[NumberToSearch, InputForm]]RealLookup[2.*Pi]<...Link here...>n = 3*Pi + 3/2; RealLookup[n/3.]<...Link here...>RealLookup[n/3]"Number must be Real, not: (3/2 + 3*Pi)/3"RealLookup["Dog"]"Number must be Real, not: Dog"-- HTH   :>)Dana DeLouisWindows XP & Mathematica 6, and 5.2 Help.  :>~ "Szabolcs" wrote in messagenews:f2eim0\$t2f\$1@smc.vnet.net...> "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);> > Is there a package with similar functionality for Mathematica?> > Szabolcs> Re: Guessing "exact" values Roman 5/18/07 3:42 AM Check out the "inverse symbolic calculator" at   http://oldweb.cecm.sfu.ca/projects/ISC/Roman. Re: Guessing "exact" values Andrzej Kozlowski 5/18/07 3:47 AM Mathematica can "recognize" algebraic numbers, by using the function RootApproximant (or the function Recognize in the Legacy NumberTherory package):ToRadicals[RootApproximant[N[Sqrt[2] + Sqrt[3], 30]]]Sqrt[5 + 2*Sqrt[6]]This may not look so impressive  until you check:FullSimplify[Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6]]]0Anyway, doing this for algebraic numbers has a solid mathematical basis: the so called LLL Lattice Reduction) algorithm. I don=92t know, =however, of any mathematical basis for "recognizing" transcendentals, =except by means of  stored values or some other "ad hoc" approach (essentially "sophisticated guessing")Andrzej KozlowskiOn 17 May 2007, at 18:59, Murray Eisenberg wrote:> As I remember, at IMS'06 (Avignon) Stephen Wolfram (via remote link-=> up)> played with a function to do just that.  Did I remember correctly?>> If so, I cannot recall the name of the function, so I don't know > whether> the function made it into 6.0.  The closest thing I can find is> RootApproximant, but that doesn't seem to "recognize" an expression> involving a transcendental number.>> 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>>>> --> Murray Eisenberg                     mur...@math.umass.edu> Mathematics & Statistics Dept.> Lederle Graduate Research Tower      phone 413 549-1020 (H)> University of Massachusetts                413 545-2859 (W)> 710 North Pleasant Street            fax   413 545-1801> Amherst, MA 01003-9305> Re: Guessing "exact" values Szabolcs 5/19/07 1:35 AM dimitris wrote:> I think there is a package of Ted Ersek but I am not sure!> Check www.wolfram.com and its archives.Thanks for everyone who replied! I learned a lot today.I did not find the package by Ted Ersek, but I found another one by Eric Weisstein:http://library.wolfram.com/infocenter/MathSource/5087/The relevant file is Simplify.mInteresting functions are ToExact and TranscendentalRecognize.In another thread someone mentioned a website which can be used for similar purposes:http://pi.lacim.uqam.ca/eng/ Re: Re: Guessing "exact" values Murray Eisenberg 5/19/07 1:51 AM When I run that code and click the link, my browser shows a "File not found!" error page.-- Murray Eisenberg                     mur...@math.umass.eduMathematics & Statistics Dept.Lederle Graduate Research Tower      phone 413 549-1020 (H)University of Massachusetts                413 545-2859 (W)710 North Pleasant Street            fax   413 545-1801Amherst, MA 01003-9305 Re: Guessing "exact" values Daniel Lichtblau 5/19/07 2:10 AM >>-->>Murray Eisenberg                     mur...@math.umass.edu>>Mathematics & Statistics Dept.>>Lederle Graduate Research Tower      phone 413 549-1020 (H)>>University of Massachusetts                413 545-2859 (W)>>710 North Pleasant Street            fax   413 545-1801>>Amherst, MA 01003-9305>>A common approach is to use a predefined basis of transcendentals, e.g certain powers of e, pi, gamma, and maybe some set of radicals of "small" integers. One then seeks rational combinations of these that give the input value to close approximation. This step typically uses LLL or PSLQ.Simple code to demonstrate the concept was presented in TMJ back in 1996 (and based on some email and maybe news group correspondence from late 1995). The reference is below.Transcendental Recognition. In: Tricks of the Trade, Paul Abbott editor. The Mathematica Journal 6(2):29-30 (1996).To obtain electronically go to:http://www.mathematica-journal.com/issue/v6i2/Scroll to Tricks of the Trade (under Tutorials), click to download the notebook, go to "Trancendental Recognition" section.I'll mention that a perusal of documentation suggests the identify() function for the most part uses this approach.Daniel LichtblauWolfram Research Re: Guessing "exact" values Szabolcs 5/19/07 11:51 PM Thanks again for all the replies!I think that I need to explain that I sent this message before I received the replies from Dana DeLouis and Roman, but for some reason it arrived with a delay of 2 days. Re: Guessing "exact" values Szabolcs 5/21/07 3:09 AM Murray Eisenberg wrote:> When I run that code and click the link, my browser shows a "File not > found!" error page.> It is because of the line break in the URL. Make sure that after you paste it, you remove the spaces which got inserted between ... "ipcgi/lookup." and "pl?Submit" ...Szabolcs