little problem(s) 2022.09
|
09-28-2022, 01:55 PM
Post: #4
|
|||
|
|||
RE: little problem(s) 2022.09
Recursive formula for obtaining k consecutive heads from n coin tosses
50 coin tosses, runs of 5 tails or more. Probability of tails = 1 - 0.6 = 0.4 >>> k, N = 5, 50 >>> p, P = 0.4, [0]*(N+1) >>> P[k] = p**k >>> for n in range(k+1,N+1): P[n] = P[n-1] + (1-P[n-k-1])*(1-p)*p**k ... >>> P[N] 0.25645932207797717 Confirmed by simulations: >>> from random import random >>> pat = lambda: ''.join("HT"[random()<=p] for x in range(N)) >>> sum('TTTTT' in pat() for i in range(10**6)) 256541 Real life is clumpy The inherent clumpiness of randomness The Longest Run of Heads - Mark F. Schilling |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
little problem(s) 2022.09 - pier4r - 09-26-2022, 07:09 PM
RE: little problem(s) 2022.09 - ijabbott - 09-27-2022, 08:10 PM
RE: little problem(s) 2022.09 - David Hayden - 09-27-2022, 09:03 PM
RE: little problem(s) 2022.09 - ijabbott - 09-29-2022, 07:39 AM
RE: little problem(s) 2022.09 - Albert Chan - 09-28-2022 01:55 PM
|
User(s) browsing this thread: 1 Guest(s)