views:

193

answers:

2

Hello, I've made a lot of random math programs to help me with my homework (synthetic division being the most fun) and now I'm wanting to reverse a radical expression.

For instance, in my handy TI calculator I get

.2360679775

Well, I want to convert that number to it's equivalent irrational expression, which is

sqrt(5)-2

I realize I could brute force it... but that takes out the fun, and isn't nearly so easy when you consider the significant round-off error of floating point.

So how would you do it? Is there is a trivial algorithm?

+4  A: 

Inverse Symbolic Calculator

Darius Bacon
Ken
How was this implemented though?
Earlz
Earlz, http://oldweb.cecm.sfu.ca/projects/ISC/isc_info.html goes into it a bit. I don't know the details, but it searches for combos of constants taken from a big table, sounds like.
Darius Bacon
The last step of this uses LLL and related algorithms, which are very powerful machinery. It looks for "short" integer linear combinations of known an "famous" constants. See also http://www.jstor.org/pss/2589743
GregS
+1  A: 

Well, your example hasn't actually transformed the input to the equivalent irrational expression, but to an equivalent irrational expression. As the Inverse Symbolic Calculator indicates, there are many candidate irrational expressions within a tolerance of the decimal number in your example, and there will be just as many irrationals within any degree of tolerance of any decimal number you specify. It's all to do with the density of irrationals along the number line.

So to answer your questions:

  • I would limit myself to a number of terms such as sqrt(2), sqrt(3), sqrt(small prime numbers), e, pi, and integers, plus rationals with small prime denominators and approximate the decimals with a few terms based on those plus the four basic arithmetical operators;
  • Is this algorithm trivial ? You decide. In general, though, I think it will be impossible to find an algorithm for determining a canonical representation of any decimal fraction as a series of irrational terms and integers, for the simple reason that no such canonical representation exists.

But then, my real and irrational maths is very rusty, I look forward to proofs that I am wrong and counter-examples.

High Performance Mark