Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: non-Markov base ten random number generator based on Pi

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52048] Re: non-Markov base ten random number generator based on Pi
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Mon, 8 Nov 2004 03:13:41 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 11/7/04 at 1:03 AM, tftn at earthlink.net (Roger Bagula) wrote:

>This result  is an experimental random number generator. It uses the
>PSLQ Bailey Pi digits rational polynomial to generate digits in the 0
>to 9 range using a process that loses information , but generally
>behaves like the Pi digits. It is not Markov, in that there is no
>previous behavior involved in calculating the next random number.

>(* Bailey formula with digit drop base 80*)
>(* base 10 random number generator that isn't Markov *)
>(* use integer seed as the number of digits in to start calculation*)
>(* other PSLQ functions of transcendental numbers could be used to do 
>this same kind of random number*)
>f[n_]=Floor[Mod[80^n*(4/(8*n+1)-2/(8*n+4)-1/(8*n+5)-1/(8*n+6))/16^n,10]]
>Digits=4000;rdpi=Table[f[n],{n,0,Digits}];
>c1=Drop[FoldList[Plus,0,Sign[Drop[rdpi,1]-Drop[rdpi,-1]]],1];
>ListPlot[c1,PlotJoined->True];
>(* Rowe Count*)
>d1=Flatten@{0,Length/@Split[Sort@c1], 0}
>Dimensions[d1][[1]]
>ListPlot[d1,PlotJoined->True];

I gather from your various posts you are trying to use the plot of c1 as a visual indicator of randomness. If that is your goal, then there are far simpler plots that are more meaningful. One of the simplest and easiest to interpret would be a plot of the cumulative distribution function for the data set.

For example:

dataSize = 10000;
data = Table[Random[Integer,{0,9}],{dataSize}];
ListPlot[
   Rest@FoldList[Plus,0,Length/@Split[Sort@data]]/dataSize,
   PlotJoined->True];

For a uniform distribution, the cumulative distribution function is x/(b-a) where a, b are the end points. That is, the cumulative distribution function for a uniform distribution should plot as a straight line from 0 to 1 over the interval (a,b).

Contrast this with

<<Statistics`DiscreteDistributions`;
data = Table[Random[BinomialDistribution[5, .5]], {dataSize}];
ListPlot[
   Rest@FoldList[Plus,0,Length/@Split[Sort@data]]/dataSize,
   PlotJoined->True];
   
The plot is clearly not a straight line indicating the data is not from a uniform distribution.

But to really demonstrate a pseudo random number generator adequately generates uniform deviates you will need more than such a simple plot.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Re: Zero divided by a number...
  • Next by Date: Re: Redefining the minus operator
  • Previous by thread: non-Markov base ten random number generator based on Pi
  • Next by thread: A NIntegrate question