Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: algebraic numbers

  • To: mathgroup at
  • Subject: [mg106250] Re: algebraic numbers
  • From: Noqsi <jpd at>
  • Date: Wed, 6 Jan 2010 05:59:52 -0500 (EST)
  • References: <> <hhpl0g$9l1$>

On Jan 4, 11:46 pm, DrMajorBob <btre... at> wrote:
> Computer reals are precisely equal to,

No. Computer reals are imprecise. That's the source of their utility.
And their difficulties.

> and in one-to-one correspondence  
> with, a miniscule subset of the rationals. Every one of them has a finite
> binary expansion.

This proves only that they are contained within a finite set.

But it makes much more sense to consider the correspondence as one-to-
uncountably-many: each individual machine real represents every real
number within an interval determined by its precision. Except for
those that don't represent numbers at all.

> x = RandomReal[]
> digitForm = RealDigits@x;
> Length@First@digitForm
> rationalForm = FromDigits@digitForm
> {n, d} = Through[{Numerator, Denominator}@rationalForm]
> d x == n
> 0.217694
> 16
> 1088471616079187/5000000000000000
> {1088471616079187, 5000000000000000}
> True

Proves nothing.

0.1 == 1/10

Now, 1/10 is *not* a member of the "miniscule subset of rationals" you
referred to above, and the machine number 0.1 does not precisely
represent it:


Note that the representation is finite and the last two bits reflect

Nevertheless, the machine manages to create a representation of 0.1,
and even reports it to be equal to 1/10. Now, if machine reals behaved
as if they were "precisely equal to ... a miniscule subset of
rationals" neither of these achievements would be possible. Their
imprecision makes this possible.

> A number can't get more rational or algebraic (solving a FIRST degree  
> polynomial with integer coefficients) than that.

All you've done is to find a number with that property equal to x
within machine precision. But since there is, in fact, an infinite set
of such numbers, finding one isn't remarkable.

> If computer reals are THE reals,

I never said they were. Go back and read what I wrote.

> why is it that RandomReal[{3,4}] can  
> never return Pi, Sqrt[11], or ANY irrational?

Well, I'm not patient enough for RandomReal[{3,4}]. But,


Seems we can easily get Pi from RandomReal. And no, I'm not cheating:
the numbers that yielded True here are equal to Pi in the only sense
that matters with an imprecise number: they are equal to Pi within
their precision.

Bobby, you're looking at how machine reals are *encoded*, and a
*subset* of them is encoded as if they were precise rationals, as you
say. But what matters is how they *behave*. They do not generally
behave like precise rationals: they behave imprecisely. And what
rational number does a NaN encode?

Rational addition and multiplication are associative, but machine real
arithmetic isn't.

Rational arithmetic is distributive, but machine real arithmetic


Machine reals are not the reals or the rationals: they are themselves,
with their own special properties. Those who reason as if machine
reals are either real or rational often suffer adverse consequences.
Much of the art of numerical analysis depends upon understanding these
special properties and their consequences.

  • Prev by Date: Re: Re: Re: algebraic numbers
  • Next by Date: Re: Re: Re: algebraic numbers
  • Previous by thread: Re: Re: Re: algebraic numbers
  • Next by thread: Re: Re: Re: algebraic numbers