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: bimodal ditribution form counting signs of Pi digits differences

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51846] Re: bimodal ditribution form counting signs of Pi digits differences
  • From: Roger Bagula <tftn at earthlink.net>
  • Date: Wed, 3 Nov 2004 01:25:39 -0500 (EST)
  • References: <4184FF1A.9020003@earthlink.net> <cm4rsv$6ql$1@smc.vnet.net>
  • Reply-to: tftn at earthlink.net
  • Sender: owner-wri-mathgroup at wolfram.com

re :b-normal->Prng pseudorandomness

-

Pi-Hacks post:
      1. Re: Digest Number 488
           From: "Dominic" 
To: mathgroup at smc.vnet.net

________________________________________________________________________
________________________________________________________________________

Message: 1         
Subject: [mg51846] Re: Digest Number 488


--- In pi-hacks at yahoogroups.com, Roger Bagula  wrote:
> Dear Dominic,
> My primary post egroup is my own true number theory group.
> Roger,
I'm curious how pi/2 can be related to an infinite sum of the 
orbital trajectories of the quadratic iterator in its chaotic regime 
but can't find a reference to this.  I understand you work in this 
field.  Do you know about this?  I thought David Bailey might so I 
contacted him as he deals with this.  Perhaps you are aware already 
of his work.  These are the references he sent me which you might be 
interested in if not (I didn't see any mention of the quadratic 
iterator at least in the first paper).

http://crd.lbl.gov/~dhbailey/dhbpapers/baicran.pdf
 
A related paper is:
http://crd.lbl.gov/~dhbailey/dhbpapers/bcnormal.pdf

Dominic




Andrzej Kozlowski wrote:

>On 1 Nov 2004, at 00:04, Roger Bagula wrote:
>  
>
>>Just looking at the distribution of digits {0,1,3,4,5} as -1
>>amd {5,6,7,8,9} as 1.
>>    
>>
>
>Presumably you mean {0,1,2,3,4} and {5,6,7,8,9}?
>
>  
>
>>As cumlative sum function of the same sort as I used with the sign.
>>It should in the case of equal probability of the digits tend to
>>a sum of zero. Variaiations as away from zero would probably be
>>function of Sqrt[n] plus and minus as a friend pointed out for the 
>>other distribution.
>>Still the
>>Random [Integer,{0,9}]
>>would be the logical null hypothesis distribution ( using a random seed
>>of somesort.
>>The idea is to try to make a measure for cumlative digit randomness.
>>    
>>
>
>If I understand you corrrectly this is a very standard test and will 
>not yield anything better than the tests that have alrady been 
>extensively performed in both cases. You can find a number of 
>considerably subtler tests in Chapter 3, Volume II of Knuth's "The Art 
>of Computer Programming". Since then many more powerful tests have been 
>designed, particulalry by George Marsaglia. They have all been used on  
>the Wolfram CA generator and on the digits of Pi.
>
>  
>
>>Since it is an interesting question,
>>comparing two pseudorandom methods would seem
>>to tell us more about both of them?
>>It is a thought experient that came up with some strange
>>results.
>>I just noticed that they didn't look right.
>>    
>>
>
>The problem is with the meaning of "look right". What size of samples 
>have you used ? What sort of statistical analysis did you subject your 
>results to? Most of all, have you looked at any serious analysis of 
>these algorithms? For example, the statistical properties of the 
>Wolfram CA algorithm (which is what Random[Integer, {0,9}] is) were 
>already analysed in Wolfram's original paper " Random Sequence 
>Generation by Cellular Automata", in Advances in Applied Mathematics 
>1986, reprinted in Wolfram's collected papers "Cellular Automata and 
>Complexity", 1994. It's only when you examine such sources and compare 
>that with your results and still find that they "don't look right" this 
>matter might become interesting. At the moment it looks exaclty like 
>Bobby Treat described it: a waste of time.
>
>Andrzej Kozlowski
>
>
>
>On 1 Nov 2004, at 00:04, Roger Bagula wrote:
>
>  
>
>>Dear Andrzej Kozlowski,
>>I read an article that said the digits of Pi were very random.
>>I had in the past sort of half heartedly counted distribution of 
>>individual digits
>>with no reall telling effect.
>>This Sign difference method seemed a better way to test the randomness,
>>I think I've hit on a better way than that:
>>Just looking at the distribution of digits {0,1,3,4,5} as -1
>>amd {5,6,7,8,9} as 1.
>>As cumlative sum function of the same sort as I used with the sign.
>>It should in the case of equal probability of the digits tend to
>>a sum of zero. Variaiations as away from zero would probably be
>>function of Sqrt[n] plus and minus as a friend pointed out for the 
>>other distribution.
>>Still the
>>Random [Integer,{0,9}]
>>would be the logical null hypothesis distribution ( using a random seed
>>of somesort.
>>The idea is to try to make a measure for cumlative digit randomness.
>>Since it is an interesting question,
>>comparing two pseudorandom methods would seem
>>to tell us more about both of them?
>>It is a thought experient that came up with some strange
>>results.
>>I just noticed that they didn't look right.
>>Andrzej Kozlowski wrote:
>>
>>    
>>
>>>*This message was transferred with a trial version of CommuniGate(tm) 
>>>Pro*
>>>Actually, Random[Integer,{0,9}] unlike Random[] already uses the  
>>>Wolfram CA algorithm, so it will not benefit form the 
>>>RandomReplacement  package.
>>>On the other hand the Wolfram CA algorithm has undergone very 
>>>demanding  testing for randomness (or rather, pseudo-randomness, 
>>>which is the case  of computers is essentially the same thing) and as 
>>>far as I know has  passed them all with flying colours. Therefore I 
>>>find it hard to  believe that someone would find something wrong with 
>>>this famous  generator using such simple methods; it's rather like 
>>>finding a trivial  counterexample to a long established theorem. 
>>>Still such things do  happen from time to time so if it is the case 
>>>this time ... Roger  Bagula is going to be famous ;-)
>>>
>>>Of course it is well known that Pi is an extremely good 
>>>"pseudo-random"  number generator, although as far as I know nobody 
>>>can prove anything  about it.  There has been a long standing 
>>>conjecture that the digits of  Pi give an inifinity-distributed 
>>>10-ary sequence though I don't think  anybody ever managed to make 
>>>any progress on this matter. However, my  knowledge of these these is 
>>>very dated; in fact it goes back to volume  2 of Knuth's ACP, but I 
>>>assume that if somebody may to prove something  spectacular in this 
>>>area I would have heard about it. The same is true  of course about 
>>>discovering non-randomness in Wolfram's CA algorithm,  though I would 
>>>expect this to be a considerably easier task than  proving anything 
>>>at all about the randomness of the digits of Pi.
>>>
>>>Andrzej Kozlowski
>>>Chiba, Japan
>>>http://www.akikoz.net/~andrzej/
>>>http://www.mimuw.edu.pl/~akoz/
>>>
>>>
>>>
>>>On 31 Oct 2004, at 15:17, DrBob wrote:
>>>
>>>      
>>>
>>>>Like the digits of Pi, Random[Integer,{0,9}] is not random--it's  
>>>>pseudo-random at best. Google for Andrzej Kozlowski's  
>>>>RandomReplacement, go to his web-page, download the package, and see 
>>>> if it helps your situation.
>>>>
>>>>Meanwhile, here's an improvement on Don Taylor's method:
>>>>
>>>>digits = 100000;
>>>>h = Rest@# - Most@# &;
>>>>Timing[rdpi = RealDigits[Pi, 10, digits][[1]];
>>>>   frdpi = Drop[rdpi, -1];
>>>>   lrdpi = Drop[rdpi, 1];
>>>>   s = Drop[FoldList[Plus, 0, Sign[Thread[Subtract[lrdpi, frdpi]]]], 
>>>> 1];
>>>>   taylor = Table[{n, s[[n + 1]]}, {n, 0, digits - 2}];]
>>>>Timing[brt4 = Transpose@{
>>>>     Range[0, digits - 2], Rest@FoldList[Plus, 0,
>>>>         Sign@h@First@RealDigits[Pi, 10, digits]]};]
>>>>brt4 == taylor
>>>>
>>>>{0.469 Second,Null}
>>>>
>>>>{0.171 Second,Null}
>>>>
>>>>True
>>>>
>>>>On Sat, 30 Oct 2004 08:35:06 -0700, Roger Bagula 
>>>><tftn at earthlink.net>  wrote:
>>>>
>>>>        
>>>>
>>>>>Dear Dr. Bob,
>>>>>Don Taylor already improved the timoing with this:
>>>>>Timing[rdpi=RealDigits[Pi,10,Digits][[1]];
>>>>>  frdpi=Drop[rdpi,-1];
>>>>>  lrdpi=Drop[rdpi,1];
>>>>>  s=Drop[FoldList[Plus,0,Sign[Thread[Subtract[lrdpi,frdpi]]]],1];
>>>>>  Table[{n,s[[n+1]]},{n,0,Digits-2}]]
>>>>>  rdpi=RealDigits[Pi,10,Digits][[1]];frdpi=Drop[rdpi,-1]; 
>>>>>lrdpi=Drop[rdpi,1];
>>>>>Drop[FoldList[Plus,{ 
>>>>>-1,0},Map[{1,#}&,Sign[Thread[Subtract[lrdpi,frdpi]]]]],1]
>>>>>
>>>>>The problem is when I use
>>>>>Random[Integer,{0,9}]
>>>>>as a simulation of the Pi digits array,
>>>>>I get a "worse" distribution ... less like what I should get  
>>>>>theoretically
>>>>>for a truly random distribution of digits.
>>>>>The Pi digits are more like what probability predicts.
>>>>>That's what I asked you help with.
>>>>>You definitely know more about statitical distriubutions in some 
>>>>>ways
>>>>>than I do.
>>>>>Don and I think it may be that the ca Random of Mathematica isn't
>>>>>working right
>>>>>in this case.
>>>>>Do tried simulationg the Sign[] difference as
>>>>>Random[Integer,{-1,1}]
>>>>>but that cuts out the bimodal/ trimodal  {a,b} probability.
>>>>>
>>>>>But thanks for replying anyway.
>>>>>You are an extremely good Mathematica programmer.
>>>>>
>>>>>DrBob wrote:
>>>>>
>>>>>          
>>>>>
>>>>>>Below I've provided a version of your program using Dynamic
>>>>>>Programming, plus another method of my own. Your code recalculates 
>>>>>> the
>>>>>>same summands repeatedly. The first difference
>>>>>>Floor@Mod[10Pi,10]-Floor@Mod[Pi,10] is calculated 2000 times to get
>>>>>>{f[1],..., f[2000]. Dynamic programming eliminates the 
>>>>>>duplications.
>>>>>>
>>>>>>In addition, there's a tremendous amount of waste involved because,
>>>>>>for instance, calculating the 2000th term requires computing Pi to
>>>>>>2000 digits (or so), but getting the 1999th term required computing
>>>>>>only one fewer digits. The two computations are completely 
>>>>>>separate,
>>>>>>each of them starting from scratch. My method eliminates THAT 
>>>>>>wasted
>>>>>>effort. (It assumes you know in advance how far you'll go, of  
>>>>>>course.)
>>>>>>
>>>>>>Here's a timing directly after Quit. Calculating again will give
>>>>>>faster times (because Mathematica caches certain results, I 
>>>>>>suppose).
>>>>>>
>>>>>>ClearAll[f, g]
>>>>>>n = 5000;
>>>>>>Timing[mine =
>>>>>>     Rest@FoldList[Plus, 0, Sign /@ ListCorrelate[{-1,
>>>>>>        1}, First@RealDigits[Pi, 10, n + 2]]];]
>>>>>>Timing[yours = Block[{$MaxExtraPrecision = n},
>>>>>>        g[i_] := Sign[Floor@Mod[10^(i + 1)*Pi, 10] -
>>>>>>Floor@Mod[10^i*Pi, 10]];
>>>>>>        f[0] = g[0];
>>>>>>        f[m_] := f[m] = f[m - 1] + g@m;
>>>>>>        f /@ Range[0, n]
>>>>>>        ];]
>>>>>>mine == yours
>>>>>>
>>>>>>{3.797 Second,Null}
>>>>>>
>>>>>>{0.016 Second,Null}
>>>>>>
>>>>>>True
>>>>>>
>>>>>>The original code's Table statement took 10.4 seconds for 500 
>>>>>>terms,
>>>>>>44 seconds for 1000, 103.6 seconds for 1500, and 195.2 seconds for
>>>>>>2000. I didn't take it to 5000, as I did in the timing above.
>>>>>>
>>>>>>It's all a waste of time, but at least you can waste a lot LESS 
>>>>>>time.
>>>>>>
>>>>>>Bobby
>>>>>>
>>>>>>On Fri, 29 Oct 2004 03:39:06 -0400 (EDT), Roger Bagula
>>>>>><tftn at earthlink.net> wrote:
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>This program  is real slow on my machine.
>>>>>>>Show a lean toward positive differences that is "slight" at 2000  
>>>>>>>digits.
>>>>>>>
>>>>>>>Digits=2000
>>>>>>>$MaxExtraPrecision = Digits
>>>>>>>(* Sum of the sign of the differences between the first 2000 
>>>>>>>digits
>>>>>>>of Pi*)
>>>>>>>f[m_]=Sum[Sign[Floor[Mod[10^(n+1)*Pi,10]]- 
>>>>>>>Floor[Mod[10^n*Pi,10]]],{n,0,m}]
>>>>>>>a=Table[{n,f[n]},{n,0,Digits-1}];
>>>>>>>ListPlot[a,PlotJoined->True]
>>>>>>>b=Table[a[[n]][[2]],{n,1,Dimensions[a][[1]]}];
>>>>>>>(* distribution of the noise that results*)
>>>>>>>c=Table[Count[b,m],{m,-12,12}]
>>>>>>>ListPlot[c,PlotJoined->True]
>>>>>>>
>>>>>>>Respectfully, Roger L. Bagula
>>>>>>>tftn at earthlink.net, 11759Waterhill Road, Lakeside,Ca 
>>>>>>>92040-2905,tel:
>>>>>>>619-5610814 :
>>>>>>>alternative email: rlbtftn at netscape.net
>>>>>>>URL :  http://home.earthlink.net/~tftn
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>
>>>>-- 
>>>>DrBob at bigfoot.com
>>>>www.eclecticdreams.net
>>>>
>>>>
>>>>        
>>>>
>>>      
>>>
>>-- 
>>Respectfully, Roger L. Bagula
>>tftn at earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 
>>619-5610814 :
>>alternative email: rlbtftn at netscape.net
>>URL :  http://home.earthlink.net/~tftn
>>
>>
>>
>>
>>    
>>
>
>  
>

-- 
Respectfully, Roger L. Bagula
tftn at earthlink.net, 11759Waterhill Road, Lakeside,Ca 92040-2905,tel: 619-5610814 :
alternative email: rlbtftn at netscape.net
URL :  http://home.earthlink.net/~tftn



  • Prev by Date: Re: bimodal distribution in sign of difference of Pi digits]
  • Next by Date: Re: Help with a calculation
  • Previous by thread: Re: bimodal ditribution form counting signs of Pi digits differences
  • Next by thread: Re: bimodal ditribution form counting signs of Pi digits differences