stochastic programsprobabilityand statistics let' try flipplot ( it generates the plots this is encouraging the ratio heads/tails is converging towards and the log of the standard deviation is falling linearly with the log of the number of flips per trial by the time we get to about coin flips per trialthe standard deviation (about - is roughly three decimal orders of magnitude smaller than the mean (about )indicating that the variance across the trials was small we canthereforehave considerable confidence that the expected heads/tails ratio is quite close to as we flip more coinsnot only do we have more precise answerbut more importantwe also have reason to be more confident that it is close to the right answer what about the absolute difference between the number of heads and the number of tailswe can take look at that by adding to the end of flipplot the code in figure title 'mean abs(#heads #tails)numtrialsstring makeplot(xaxisdiffsmeanstitle'number of flips''mean abs(#heads #tails)''bo'logx truelogy truetitle 'sd abs(#heads #tails)numtrialsstring makeplot(xaxisdiffssdstitle'number of flips''standard deviation''bo'logx truelogy truefigure absolute differences