MathGroup Archive 2009

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

Search the Archive

Re: Re: Creating a Random Function to Select an Irrational

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102242] Re: [mg102210] Re: [mg102176] Creating a Random Function to Select an Irrational
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Sun, 2 Aug 2009 06:00:45 -0400 (EDT)
  • References: <200907310957.FAA19545@smc.vnet.net> <200908010801.EAA07130@smc.vnet.net>

On 1 Aug 2009, at 17:01, DrMajorBob wrote:

> The good news is, 100% of real numbers are irrational. That is, the  
> odds
> of selecting a real at random and getting a rational is precisely  
> zero.
>
> The bad news is, machine-precision (and arbitrary precision) real  
> numbers
> are 100%, unanimously rational. So are their sums, differences,  
> products,
> and ratios.

It may be more of a philosophical than mathematical issue, but I do  
not think it is correct to say that approximate numbers are rational.  
This is confirmed by Mathematica itself:

Element[1.1, Rationals]
False

This is not just some kind of Mathematica weirdness but a perfectly  
logical interpretation of approximate numbers. They are neither  
rational not irrational; any one of them represents infinitely many  
possible rational or irrational numbers. If you chose to interpret  
approximate numbers as rational then you could not possibly claim that  
RandomReal[{0,1}] is uniformly distributed on the unit interval  
because there are infinitely many rationals e.g. 1/3 that can never be  
obtained as the value of RandomReal. So the only sensible  
interpretation is that all approximate numbers are neither rational  
nor irrational - we can think of them as given by "initial digits"  of  
rational or irrational reals.

The OP question, about randomly generating irrationals does not, of  
course, have any mathematical sense. There is no such thing as a  
"random number", there are only sequences of numbers distributed  
according to some distribution. We can additionally require that there  
should not be any "regularities" in the sequence of numbers so  
generated - and this of course is problematic as the concept of  
"regularity" is hard to make precise.

As an example: we could generate irrational numbers approximately  
uniformly distributed in the interval {0,1} by a formula like this:

Rationalize[RandomReal[{0, 1}], 0] + Sqrt[2]/10^18

the numbers so obtained are certainly irrational and approximately  
uniformly distributed. Looking at their digits is not likely to reveal  
any "regularity" but of course we know that they the generated  
sequence has a "regularity": the difference of any two numbers is  
always rational. There are obviously infinitely many ways of  
generating similar sequences and they are obviously all equally useless.

A more interesting (in my opinion) way to generate a random real  
number is by specifying its digits as follows:

r[0] = RandomInteger[{0, 1}, 1];
r[n_] := r[n] = Append[r[n - 1], RandomInteger[{0, 1}]]

This defines a unique real number, almost certainly irrational, whose  
digits can be computed (in principle) to arbitrary precision, e.g. in  
this case

N[FromDigits[{r[120], 0}, 2], 100]
   
0.5216581269311984505815006839069293336802568327655056358867877566088653250230499323902844110989462934

In reality this number will be "irrational" only if the random number  
generator is truly random, otherwise the series of digits may start  
repeating at some point and the number will turn out to be rational.

Related to the above but more interesting and deeper examples of  
random irrationals are Chaitin constants (http://mathworld.wolfram.com/ChaitinsConstant.html 
).

Andrzej Kozlowski

>
> (The good and bad news may seem contradictory, but they are not.)
>
> So, the only way to get irrational numbers in Mathematica is using  
> symbols
> (Pi, E, for instance) and expressions you know are irrational, such as
> Sqrt[2]. Your link shows a few other ways. But it's hard to call  
> creating
> one of these "random".
>
> You could make a long list of irrational numbers and randomly sample  
> them,
> perhaps adding several together... but I don't see what you could  
> prove or
> accomplish, with such a procedure.
>
> Bobby
>
> On Fri, 31 Jul 2009 04:57:40 -0500, BenT <brtubb at pdmusic.org> wrote:
>
>> Although Mathematica has built-in functiona to obtain random integers
>> and real
>> numbers, I need to select a random irrational number. At this
>> webpage,
>>
>> http://mathworld.wolfram.com/IrrationalNumber.html
>>
>> several definitions are given for known conditions to create
>> irrational numbers, such as
>>
>> Numbers of the form n^(1/m) are irrational unless n is the mth power
>> of an integer.
>>
>> Can anyone define a function to allow a similar capability as  
>> Random[]
>> in selecting a "member" from the above defined "set" of values, or  
>> any
>> other of the definitions listed on the same webpage?
>>
>
>
>
> -- 
> DrMajorBob at bigfoot.com
>



  • Prev by Date: Re: Re: Creating a Random Function to Select an Irrational
  • Next by Date: Simple Slideshow templates?
  • Previous by thread: Re: Re: Creating a Random Function to Select an Irrational
  • Next by thread: Re: Creating a Random Function to Select an Irrational