Simulation of the number of heads for n flips of a fair coin, for n from 1 to 2048. Each "experiment" is repeated 10,000 times to collect statistics. The observed number of heads is near μ=n/2, but with some variance about that mean value. The fractional standard deviation (i.e., σ=sqrt(variance) divided by μ=mean) decreases as n increases. The figures are plotted to keep mean n/2 at a fixed position, to clarify that ratio is decreasing (diminishing width of probability distribution, with standard deviation / mean = σ/μ decreasing as 1/sqrt(n)).


Simlar simulation of the number of sixes for n rolls of a fair die, for n from 1 to 2048. Each "experiment" is repeated 10,000 times to collect statistics. The observed number of heads is near μ=n/6, but with some variance about that mean value. The fractional standard deviation (i.e., σ=sqrt(variance) divided by μ=mean) decreases as n increases. The figures are plotted to keep mean n/6 at a fixed position, to clarify that ratio is decreasing (diminishing width of probability distribution, with standard deviation / mean = σ/μ decreasing as 1/sqrt(n)).


Code used to generate these animated gifs: bsims.ipynb