Ned Batchelder wrote:

> […]
>     This is done empirically, by producing `nseq` sequences of
>     `nrolls` rolls of the die.  Each sequence is examined to
>     see if it has a zero.  The total number of no-zero
>     sequences divided `nseq` is the probability.

No, it is not.  It is the relative frequency for *this* number of trials and 
*this* run of the experiment.

>     """
>     no_zeros = 0
>     for _ in xrange(nseq):
>         seq = die_rolls(nrolls)
>         if not any_zeros(seq):
>             no_zeros += 1
>     return float(no_zeros)/nseq
> 
> for n in range(10, 101, 10):
>     # Calculate the probability of getting no zeros by trying
>     # it a million times.
>     prob = probability_of_no_zero(n, 1000000)
>     print "n = {:3d}, P(no zero) = {:.8f}".format(n, prob)
> 
> 
> 
> Running this gives:
> 
> $ pypy testrandom.py
> n =  10, P(no zero) = 0.34867300
> n =  20, P(no zero) = 0.12121900
> n =  30, P(no zero) = 0.04267000
> n =  40, P(no zero) = 0.01476600
> n =  50, P(no zero) = 0.00519900
> n =  60, P(no zero) = 0.00174100
> n =  70, P(no zero) = 0.00061600
> n =  80, P(no zero) = 0.00020600
> n =  90, P(no zero) = 0.00006300
> n = 100, P(no zero) = 0.00002400
> 
> 
> As n increases, the probability of having no zeros goes down.

Your programmatic "proof", as all the other intuitive-empirical "proofs", 
and all the other counter-arguments posted before in this thread, is flawed.  
As others have pointed out at the beginning of this thread, you *cannot* 
measure or calculate probability or determine randomness programmatically 
(at least not with this program).  I repeat: Probability is what relative 
frequency (which you can measure) *approaches* for *large* numbers.  100 is 
anything but large, to begin with.  What is “large” depends on the 
experiment, not on the experimentator.  And with independent events, the 
probability for getting zero does not increase because you have been getting 
non-zeros before.  It simply does not work this way.

If you had read the article I referred you to, you would have known that 
this approach, this program, is bogus.  I see no logic to continue here as 
long as you do not realize and recognize the Gambler’s fallacy on which all 
arguments presented so far, including yours, are based.  I would only be 
wasting more precious free time by repeating myself in one way or another.

This should give you pause: In real mathematics, events with zero 
probability can occur.

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to