Link to home
Start Free TrialLog in
Avatar of ethanjohnsons
ethanjohnsons

asked on

Probability distribution

An apparatus exists whereby a collection of balls is displaced to the top of a stack by suction. A top level (Level 1) each ball is shifted 1 unit to the left or 1 unit to the right at random with equal probability. The ball then drops down to level 2. At Level 2, each ball is again shifted 1 unit to the left or 1 unit to the right at random. The process continues for 15 levels and the balls are collected at the bottom for a short time until being collected by suction to the top.

What would be the exact probability distribution of the position of the balls at the bottom with respect to the entry position, which is arbitrarily denoted by 0?
Avatar of ozo
ozo
Flag of United States of America image

Avatar of JR2003
JR2003


http://en.wikipedia.org/wiki/Binomial_coefficient

1 15 105 455 1365 3003 5005 6435 6435 5005 3003 1365 455 105 15 1
Sum = 32768

1/32768    15/32768    105/32768   455/32768   1365/32768  3003/32768  5005/32768  6435/32768  6435/32768  5005/32768  3003/32768  1365/32768  455/32768   105/32768    15/32768    1/32768

A binominal distribution can also be approximated to a normal distribution
http://www.stat.yale.edu/Courses/1997-98/101/binom.htm
Avatar of ethanjohnsons

ASKER

ok, how do you have an approximation to this distribution??

1/32768    
=3.051758e-05
15/32768    
=0.0004577637
105/32768  
=0.003204346
455/32768  
=0.01388550
1365/32768  
=0.04165649
3003/32768  
=0.09164429
5005/32768  
=0.1527405
6435/32768  
=0.1963806
6435/32768  
=0.1963806
5005/32768  
=0.1527405
3003/32768  
=0.09164429
1365/32768  
=0.04165649
455/32768  
=0.01388550
105/32768    
=0.003204346
15/32768    
=0.0004577637
1/32768
=3.051758e-05

thx  

ej
Didn't we explain that?
15!/((15+n)/2)!*((15-n)/2)!*2^15)
which might be approximated by
exp(-1**2/(2*15))/sqrt(2*pi*15/4)
ok, thx much.

Can you do a simulation of the process with 100 balls? I like to plot the frequency distribution of the position of the balls at the bottom with respect to the entry position.
yes I can.
I'm not sure how to do it in Microsoft SQL, but I could probably come up with a way to do it in MySQL, which may be similar enough.
Sub Test100

    Dim i as Long
    For i = 1 to 100
        Debug.Print BeanMachine()
    Next i

End Sub

Function BeanMachine() as Long

    Dim i as Long
    Dim iPosition as Long

    For i = 1 to 15
        dblRandomNumber = Rnd()
        If Rnd > 0.5 Then
            iPosition = iPosition + 1
        Else
            iPosition = iPosition - 1
        End If
    Next i
    BeanMachine = iPosition

End Function
This one runs 10 million trials. I ran it as a Word macro and it took about 2 minutes to run:

Sub TestNTrials()

    Dim i As Long
    Dim arrResults(-15 To 15) As Long
    Dim iResult As Long
    Dim Trials As Long
    Trials = 10000000
    For i = 1 To Trials
        iResult = BeanMachine()
        arrResults(iResult) = arrResults(iResult) + 1
    Next i
    For i = LBound(arrResults) To UBound(arrResults)
        Debug.Print arrResults(i) / Trials
    Next i

End Sub

Function BeanMachine() As Long

    Dim i As Long
    Dim iPosition As Long

    For i = 1 To 15
        dblRandomNumber = Rnd()
        If Rnd > 0.5 Then
            iPosition = iPosition + 1
        Else
            iPosition = iPosition - 1
        End If
    Next i
    BeanMachine = iPosition

End Function



Here are the results:

 0.0000306
 0
 0.0004566
 0
 0.0031985
 0
 0.0139083
 0
 0.0415539
 0
 0.0917678
 0
 0.1528134
 0
 0.1962831
 0
 0.1962994
 0
 0.1527996
 0
 0.0917336
 0
 0.0415497
 0
 0.0139308
 0
 0.0031917
 0
 0.0004529
 0
 0.0000301


Note that the even positions in the array are zero as there are an odd number of levels
ok..
why are there so many 0 (zero)s?  

thx
When the level is odd, tthere will be an odd number of shifts, so the probability of an even shift is 0
ASKER CERTIFIED SOLUTION
Avatar of JR2003
JR2003

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial