From: Marnen Laibow-Koser Date: 2009-11-17T09:34:32+09:00 Subject: Re: Trajectories Caleb Clausen wrote: > On 11/16/09, Marnen Laibow-Koser wrote: >> Certain numbers, such as square roots, can be represented with tricks >> like quadratic equations to which they are the root, but that won't work >> for transcendental numbers like e or �. We can calculate those numbers >> to millions of decimal places if we need to -- but unlike rational >> numbers, we can never store them exactly. > > transcendentals can also be represented exactly by formulae with a > finite number of bits: > > pi/4 = 1 - 1/3 + 1/5 - 1/7 + .... > #that might not be the exact right formula, but you get the idea Oh, good point. Hadn't thought about that. > > this can also be represented by a (fairly short) program: > > def pi_over_4 > result=0 > sign=1 > for i in 0..Infinity do > result+= Rational.new(sign,2*i+1) > sign=-sign > end > return result > end > > of course, this would take an infinite amount of time to execute, and > require an infinite amount of memory to store the result, but in a > lazy functional language like haskell, that would not be true. also, > in a functional language, I _believe_ you can manipulate programs like > the one above as if they were numbers. To some extent, you can do that in Ruby. Proc and Method are first-class objects. > how often is that capability > really needed? Which capability? Functional programming? It can be useful. > maybe mathematica actually works this way, but it's > probably the only one. I'm not sure. > > on the other hand, there is another class of (real) numbers, the > incomputables, beyond the transcendentals, for which there is no > (finite length) formula or program possible.... but how often do you > need to write a program which deals with (an exact representation of) > those? I don't know. Are any important constants incomputable? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.