The Random Walk Hypothesis (as stated in Feynman’s Lectures) has always troubled me. Maybe the problem lies in my basic understanding of probability. Whatever it is, I can’t seem to get a grip on it.
There is a man who tosses a coin. If heads, he moves one step forward. If tails, he moves one step backwards. Where will he end up after N number of tosses? Let us call his final distance as D. We are considering a sufficiently large N, i.e. N → ∞. We might think that D → 0, since eventually the number of heads and number of tails will balance out (both of their probabilities being equal). That is not the case.
when N=2, we might easily to get 2 heads and 0 tails, so D=2.
when N=50, we might get 28 heads and 22 tails, so D=6.
when N=1000, 520 heads and 480 tails, D=40.
and so on…
The above numbers are just speculations using common sense. Note that D does not decrease, but is rather likely to increase at a slow rate, with increasing N. Due to the difference in rates of increase, the quantity D/N is likely to decrease with increasing N.
Hence, D/N → 0 when N → ∞.
The Random Walk Hypothesis states that the expected value of D should be √N. You can see that it agrees with the condition: D/N → 0 for N → ∞. The mathematical proof is simple too. What bothers me is that this expected value is seldom reflected in experiments.
In the following simulation, I’ve assumed that Python’s randomness generating skills are good enough for the task. Any number of experiments can be performed. Each experiment will consist of an user-defined number of tosses. The program will calculate the final distance in each experiment, and display the number of experiments that matched the theory, and the absolute average distance. Ultimately it will state whether the average experiment agrees with the theory or not. I’ve allowed a standard error of 10%.
import random pos=0 apos=0.0 sum=0 avg=0.0 noe=0 cnt=0 noe=input("Enter number of experiments: ") steps=input("Enter number of steps per experiment: ") print "Performing experiments..." for a in range(0,noe): for i in range(0,steps): j=random.randint(0,1) if j==1: pos+=1 else: pos-=1 sum=sum+abs(pos) apos=abs(pos)*1.0 if apos=(0.9*(steps**(0.5))): cnt=cnt+1 pos=0 noe=noe*1.0 avg=sum/noe print "Expected value of distance: %d"%(steps**(0.5)) print "Number of experiments agreeing with the theory = %d"%cnt print "Absolute average distance: "+ str(avg) if cnt>=(noe-cnt): print "The average experiment satisfies the theory." else: print "The average experiment disagrees with the theory."
Enter number of experiments: 50
Enter number of steps per experiment: 1000000
Expected value of distance: 1000
Number of experiments agreeing with the theory = 4
Absolute average distance: 801.32
The average experiment disagrees with the theory.
As you can see, the average experiment with N = 1 million tosses each failed to agree with the theory. But the average distance (801.32) looks promisingly close to 1000, so higher values of N might work. It’ll take a long time to execute though.