Re: Range#member? Oddity
On Sun, 15 Jan 2006, Stefan Walk wrote:
Enumerable means that you can map the natural numbers to your set in an
invertable way, and that's not possible for ranges of real numbers. Being
enumerable means the possibility of a "succ" operation, and therefore of
traversing the whole set with "each" (which may take infinite time). Being
enumerable implies a working each, now try (1.0..2.0).each...
that is certainly true. however, there are no real numbers in computing -
only rational numbers and rationals are countably infinite
http://mathworld.wolfram.com/CountablyInfinite.html
http://mathworld.wolfram.com/RationalNumber.html
while (1.0..2.0).each{|x| p x} cannot work with real numbers it can certainly
work with a set of rational numbers - in computing terms you can certainly
count from 1.0 to 2.0 by adding the floating point epsilon. my opinion is
that we're talking computer languages here, not mathematicaly ones, and so any
idea of being 'correct' must be in the context of what computers can do.
in any case, ruby makes no guarantee that
(a..b).each{|x| p x}
will complete, so even if we had real numbers that would still be a valid
construct - though mixing in Enumerable into Range would be strange then - but
it not the case.
cheers.
-a
--
strong and healthy, who thinks of sickness until it strikes like lightning?
preoccupied with the world, who thinks of death, until it arrives like
thunder? -- milarepa
.
Relevant Pages
- Re: Why does Cantor a target for cranks?
... instead we talk about the abstract rationals which are ... after which we cite an infinite sequence of zero digits) and others ... is in the sub-sequence that generates computable reals or not. ... computing algorithm that enumerates the integers, ... (sci.math) - Re: Arithmetic on computable reals
... |It is fairly obvious that all rationals are D-computable. ... separately to show that it holds for irrationals. ... then, is keep computing terms of the sequence r1,r2,r3,... ... Then apply the equivalence of D-computability with computability. ... (sci.math) - Re: Idiomatic Ruby for Array#extract / Range#length?
... represent an enumeration of the rationals in ... True in theory, but, I wonder just how you would code succ so as to ... Let f be a bijection between the rationals in the open interval (0, ... true that ranges require the starting and ending elements to implement ... (comp.lang.ruby) - Re: Arithmetic on computable reals
... The computable reals are ... a vector space over the rationals with a countable algebraic ... and its unique representation as a linear combination ... of the particular sum we are dealing with by computing the ... (sci.math) - Re: Groebner bases over the integers
... computing over the rationals would make it ... want to simplify a formula ... this would mean, however, that I have to carry out the reduction really ... (sci.math.symbolic) |
|