6 views

Skip to first unread message

Mar 3, 2002, 6:30:02 AM3/3/02

to

I hope someone can explain this.

A characteristic of a truly random behavior is that events tend to

cluster.

E.g. a molecular collision is more likely to occur just after the most

recent collision.

or, in a bit stream, a bit error is more likely to occur just after the

most recent error if the errors are generated by random noise.

I simulated this with a generated vector with ones and zeroes with a

given probability using Random and RandomSeed in Mathematica 3.01. and I

found something peculiar with the random generation in Mathemathica,

Just run these lines and see for yourself:

SeedRandom[1111111 ] (*change this number to get another random

sequence*)

vec1=Table[Random[Real,{0,1000}],{10^6}]; (*reduce this

vector length if you get memory problem*)

vec2=Map[If[#<44,1,0]&,vec1]; (*threshhold for

ones*)

ones=Flatten[Position[vec2,1]]; (*vector of index

positions for ones *)

Length[ones]/10.^6 (*check for the

average of ones*)

plotvec=Map[Length,Split[Sort[Drop[ones-RotateRight[ones,1],1]]]];

(*subtracts ones[[i]]-ones[[i+1]]*)

ListPlot[Log[plotvec],PlotRange->All]

It is the plot that seems a bit strange to me, I get the expected

decreasing exponential behavior in

the probability of the interval length between ones.

But, (this is the question) in all different simulations I have made

with different RandomSeed[], average

of ones, different vector length, the interval of 24 have a lower

frequency than expected.

If this behavior persists when you test, what is the reason?

If not, why do I get it, I have tried it on two computers.

hehe.. if you reverse 24 you get 42???

Peter W

Mar 5, 2002, 3:23:20 AM3/5/02

to

I once responded to an equivalent question in this news group:

http://library.wolfram.com/mathgroup/archive/2000/May/msg00088.html

In that case as well something bad happened in the 24th bin which was

(as in your case) reliably under where it should have been.

The upshot is that this appears to be a hazard of subtract-with-borrow

based random generators, which is what is used to generate random

machine doubles. This defect does not appear to afflict the cellular

automaton generator used to form random integers smaller than 2^30.

Hence to ellude it in your example you might do as below.

SeedRandom[1111111];

vec1 = Table[Random[Integer,1000],{10^6}]; (* generate integer instead

of real *)

vec2 = Map[If[#<=44,1,0]&, vec1];

ones = Flatten[Position[vec2,1]];

Length[ones]/10.^6

plotvec = Map[Length, Split[Sort[Drop[ones-RotateRight[ones,1],1]]]];

ListPlot[Log[plotvec], PlotRange->All]

For further information, more general workarounds, etc. I defer to my

5/00 post at the URL above.

By the way, I don't think clustering is equivalent to "a bit error is

more likely to occur just after the most recent error if the errors are

generated by random noise."

Daniel Lichtblau

Wolfram Research

Reply all

Reply to author

Forward

0 new messages

Search

Clear search

Close search

Google apps

Main menu