Link to home
Start Free TrialLog in
Avatar of InteractiveMind
InteractiveMindFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Probability question

Suppose there is a bottle of pills, if a whole pill is drawn, it is bitten in half then one of the halves is placed back in the bottle. If a half is drawn, then it is taken and it disappears from the bottle. And every pill, half or whole, is equally likely to be picked.

How could I make a function P(n) that tells me the probability of drawing a half after n trials?


Thanks
SOLUTION
Avatar of Harisha M G
Harisha M G
Flag of India image

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
Avatar of InteractiveMind

ASKER

Hmm, I see what you mean.

Perhaps there's some sort of recursive algorithm which could be used?
..As it doesn't actually *have* to be a math function; an algorithm is fine..

:\

Any ideas?

Cheers
SOLUTION
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
Rob, not related to probability, but it gives the states which are traversed..

This is an Excel Macro..

Sub States()
    Sheets(1).Activate
    Sheets(1).Cells.Clear
    N = InputBox("Enter N")
    Dim i As Double, j As Double, k As Double
    For i = N To 0 Step -0.5
        m = 0
        For j = Int(i) To 0 Step -1
            For k = 0 To 2 * i
                If ((j + k * 0.5 = i) And (j + k <= N)) Then
                    m = m + 1
                    Cells((N - i) * 2 + 1, m) = j & " " & k
                End If
            Next
        Next
    Next
End Sub
Avatar of ECNSSMT
ECNSSMT

err unless you've assume that the 1/2 bitten pill was placed back in the bottle in a random manner (placed back and the bottle was shaken); it can fairly be assumed that the pill will be on top or close to the top of the bottle.  

This implies that the 1/2 bitten pill has a better chance of being picked than the normal 1 in N chances.  The pills towards the top of the bottle has a better chance of being pick by the pill popping community than the ones in the bottom of the bottle.

Unless someone has a hand small enough to reach in to the bottle to permit the equal choosing of all pills per the length of the bottle. Or the pills are placed in a big enough bottle where all the pills have an equal chance of being picked....

Regards,  

This is a discrete problem that would probably benefit from an analog solution.

Note that the system will tend to regulate itself so that the number of whole pills and half pills is the same.
    If there are more whole pills, they are more likely to get chosen and broken.
    if there are more half pills, they are more likely to get chosen and removed.

So I would expect something like

             1  -  exp(-kn/N)
P(n)  =   ------------------
                     2

I would recommend a few simulations to find the value of k.  And I wouldn't be surprised if  k=1  for N > n >> 0.
And it is to be noted that the probability of picking half pill in the last stage is 1, and the last stage is 2N

So, we know..

P(1) = 0
P(2) = 1/N
P(3) = 2(N-1)/N
...???...
P(2N) = 1
Sorry.. P(3) = 2(N-1)/N²
Here is my Excel simulation.  You can change the starting conditions (1000, 0) and k.

                   http://www.geocities.com/d_glitch/Pills.xls

So I see k=2.  Still trying to understand why it doesn't regulate to 0.5 later though.

             1  -  exp(-2n/N)
P(n)  =   ------------------           for N >> n >> 0
                     2

This isn't true:
>>   Note that the system will tend to regulate itself so that the number of whole pills and half pills is the same.

If you start off with  W = N whole pills and  H = 0 half pills and run the experiment to the end,
you are guaranteed to pull out N whole and N half pills in 2N trials.

So the average probabilities for whole and half pills in 0.5.

The probability for pulling half pills starts at 0, and grows.  It has to be more than 0.5 at the end of the experiment.

When the number of whole and half pills is equal, the effects of pulling one or the other are not symetric.
=====================================================================

I do believe my mini Monte Carlo model is correct.

If you start with W(0) = N  and  H(0)=0  

                                  N *( exp( -n/N) - exp(-2))
I estimate     W(n)  =  --------------------------------       but it still needs a tweak or two
                                           1-EXP(-2)

                    H(n)  =  2*(N - W(n)) - n

                    PH(n) = H(n)/(W(n)+H(n))       ==>            probability of pulling a half pill after n trials


According to the latest model it fits pretty well:

                        http://www.geocities.com/d_glitch/Pills2.xls


The top chart is W(n)  H(n)    and    W(n)+ H(n)

The second chart is  PH(n) observed and calculated.
ASKER CERTIFIED SOLUTION
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
Thanks all.

I can actually somewhat understand the logic behind your solution d-glitch :)