Re: normal digits base 10 ( used to be: bimodal ditribution form counting signs of Pi digits differences)

*To*: mathgroup at smc.vnet.net*Subject*: [mg51964] Re: normal digits base 10 ( used to be: bimodal ditribution form counting signs of Pi digits differences)*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Fri, 5 Nov 2004 02:20:00 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

On 11/4/04 at 1:50 AM, tftn at earthlink.net (Roger Bagula) wrote: >This may be a very bad way of doing this but it's what I get to >work. The idea is to get a base 10 digit set that is "normal" in >randomness and not an equal probability random distribution. Precisely, what do you mean by "normal" above? Do you mean you want a set of digits from 0 to 9 distributed as a normal (gaussian) distribution? If so, there isn't any way to achieve this. Any distribution of the digits from 0 to 9 will be a discrete distribution by definition. A normal distribution is a continuous distribution. The minimum step size between pairs of digits from 0 to 9 is too large to be well approximated by a continuous distribution. >(There is probably a better way to do this. It you know a way let me >know.) It does give a different type of count distribution, but it is >still unlike the Pi digits based distribution. (* Sign[] of normal >based distribution of digits*) Once you operate on the digits with some function such as Sign, you change the distribution. And once you change the distribution you have to change your test accordingly to arrive at valid conclusions. In general, this is a poor analytical technique. Applying simple functions to a set of numbers can easily change the distribution in some very complex ways that are difficult to analyze. You would be far better off applying any test to the original distribution rather than a distribution modified by some function. There is a large body of literature on how to evaluate whether the output of a psuedo random number generator as a uniform distribution or not. You should be able to find examples of test proceedures by looking on the NIST web site or doing a Google search. Better yet, visit your local library and read the first few chapters of Knuth The Art of Computer Programming Vol 2 Seminumerical Algorithms. Note, while these proceedures are geared toward testing whether a set of numbers is from a uniform distribution, they can be adapted to be used for testing against any distribution. The key is to realize the cumulative distribution function of any density function maps the orginal distribution to a uniform distribution. >SeedRandom[123]; >Clear[rdpi,c,d] >rdpi=Table[Mod[Floor[Abs[10*InverseErf[Random[Real,{-1,1}]]]],10],{ >n,1,Digits}]; I am guessing your intent is to generate normal deviates. If so, you would be better off doing <<Statistics` Table[Random[NormalDistribution[0,1], {n}] where n is the number of normal deviates you want. If the specific distribution you want is not one contained in Statistics`ContinuousDistributions` or Statistics`DiscreteDistributions`, then the first few chapters of Knuth also describes how to generate random numbers of any desired distribution starting from a uniform distribution. >c2=Drop[FoldList[Plus,0,Sign[Drop[rdpi,1]-Drop[rdpi,-1]]],1]; >(*Rowe count*) d2=Flatten@{0,Length/@Split[Sort@c2], 0} >ListPlot[d2,PlotJoined->True]; You do need to realize, what I gave you in my first response to you was merely a way to speed up the code you posted. Using the Sign function the way you are doing *is not* a good way to test for randomness. Using Sign as you are doing throws away a tremendous amount of information because it maps every sequence of digits to the set {-1,0,1}. Because there is a large amount of information thrown away, I am fairly certain I can take another symetric discrete distribution that is clearly not a uniform distribution and get exact same result as if I started with a uniform distribution. That is using Sign in the way you are doing is a very very bad idea in terms of testing for randomness. -- To reply via email subtract one hundred and four