Hacker News new | ask | show | jobs
by umanwizard 3076 days ago
Actually it's possible to represent 1/3 perfectly accurately, but what about all the numbers that it's theoretically impossible to compute? (Almost all real numbers have this property)
4 comments

> Almost all real numbers have this property

> Almost all

I love this comment because it brings back memories of school.

In a layman's terms, I think almost all in this case means all but a finite amount

can we say almost all real numbers are irrational?

1 1/1 2/1 3/1 4/1 5/1 ... 2 1/2 2/2 3/2 4/2 5/2 ... 3 ...

so clearly we can count all the rational numbers but how many irrational numbers are there? are there (many) more irrational numbers than there are rational numbers?

The rationals have measure zero, so almost all reals are irrational. The Cantor set is an example of an uncountable set which also has measure zero.

http://austinrochford.com/posts/2013-12-31-almost-no-rationa...

It's not a finite amount, but an amount with measure zero.
You can count computable irrationals by numbering the algorithms that calculate (successive approximations to) them and lining them up in order. This is what Turing used his "Turing Machines" to do.

So all of the irrationals that we use or could ever use in calculations are countable. The uncountability of the irrationals comes entirely from the uncomputable ones, which we will probably never see.

The reals are deeply weird.

The rational numbers are clearly countable. The irrational numbers are uncountable, which means that for every rational number there are infinitely many irrational numbers.
But for every integer there are also an infinite number of rationals. And since we can put the rationals into 1-1 correspondence with integers, that means that for every rational there are an infinite number of rationals.

Infinity is funny like that.

The conclusion that there are somehow more irrationals than rationals depends on subtle philosophical points that have no possible proof or disproof and usually get glossed over. Accepting that philosophy also leads to the conclusion that not only do numbers which can in no way ever be represented exist, but there are more of them than numbers which we can explicitly name. Now I ask you, in what sense do they REALLY exist?

> The conclusion that there are somehow more irrationals than rationals depends on subtle philosophical points that have no possible proof or disproof and usually get glossed over

Can you elaborate? The proof that there are more irrationals than rationals is very straightforward, from my perspective.

The easiest way to understand it is to look at the question from a philosophical framework where it makes no sense to claim that there are "more" irrationals than rationals. And then untangle why it came to a different answer.

In Constructivism, all statements have 3 possible values, not 2. They are true, false, and not proven. All possible objects must have a construction. So instead of talking about a vague "Cauchy sequence", we might instead have a computer program that given n will return a rational within 1/n of the answer.

The first thing to notice is that all possible things that could exist is contained within a countable set of all possible constructions. There can't be "more" irrationals than rationals.

But what about diagonalization? That proof still works. You still can't enumerate the reals. But why not? The answer is because determining whether a given program represents a real is a decision problem that cannot in general be solved by any algorithm. You are running into the same category of challenges that lie behind Gödel's theorem and The Halting Problem. It is not that there are "more" irrationals than rationals. It is that there are specific programs which you can't decide whether they represent reals.

From a constructivist's eyes, the traditional proof that there are more irrationals falls apart because you're reasoning about unprovable statements about arbitrary sequences whose logic could have been constructed with the same sort of logic that you're applying to them. Is it any wonder that you wind up concluding the "existence" of things that clearly don't actually exist?

Now stepping back from BOTH philosophies, the differences between them lie in different attitudes about existence and truth. Attitudes that underly the axioms which we use, and cannot possibly be proven one way or another. (Gödel actually proved that. Any contradiction in Constructivism is immediately a contradiction in classical mathematics. But conversely there is a purely mechanical transformation of any proof in classical mathematics which resulted in a contradiction, into a constructive proof that also results in a contradiction.)

Excellent explanation, thanks! But I feel compelled to point out that only a small minority of working mathematicians are constructivists.
For every rational, there are infinitely many rational numbers too, since finite cartesian product of countable sets is countable.
I wasn't talking about irrational numbers.
But all non-computable numbers are irrational.
No, there are also non-computable numbers that are imaginary, complex, or transfinite.
All rational numbers are real. Therefore all non-real numbers are irrational.
Yes, almost all real numbers are irrational, but I was talking about non-computable numbers, not irrational numbers.
Well, if I remember correctly, a product of an irrational and a rational is still irrational, right?

If so, here's a simple argument: If you have N rational numbers and I have K irrationals to start with, I can produce roughly N*K additional irrationals. Since we know at least two irrationals (pi and e) we can make at least twice as many irrationals as rationals.

Unfortunately this argument fails -- there are twice as many whole numbers as there are odd numbers right? but they are in 1:1 correspondence

0 <-> 1

1 <-> 3

2 <-> 5

   :
so the odd and whole numbers have the same cardinality: there are the same number of each.
There are, see Cantor's diagonal argument.
If they can't be computed, what are you planning on using them for? The biggest problem is going to be with the useful transcendentals.
At the risk of explaining the joke, obviously if I can't compute a number I won't need to represent it...
>Actually it's possible to represent 1/3 perfectly accurately

I'm curious, how?

> I'm curious, how?

As 1/3 - exactly as it's on your screen. All rational numbers can be represented exactly.

Hmm, yes, it can be represented in ASCII. But you still have to approximate when storing it in a way that is actually useful for computation using a finite number of bits.
Many real programming languages support arbitrary precision decimal and/or rational numbers.

Sure, there are times when space or speed concerns favor inexact representation over correctness, but that's an optimization that ought to be properly evaluated; the fact that lots of languages are designed in a way which makes it the default everyone reaches for contributes to lots of errors.

    struct rational {
        int numerator;
        int denominator;
    };
And another dumb questions:

Is possible to convert to rationals in calculations?

So if I do:

1/3 + 4 + sum / total it record values properly?

Yes. Common Lisp is an example of a language that can represent rationals exactly and do arithmetic on them. You can avoid floating-point precision loss by using this method. But there are drawbacks: 1) The numerator and denominator will often turn into bignums as a calculation progresses, consuming ever-larger amounts of space and time, and 2) This won't help you with any calculation involving irrationals, except to prevent your initial imprecision from growing larger.