For X binomial with n trials and success probability p, the exact probability of a ≤ X ≤ b is a sum of bars. The normal curve with the same mean and variance approximates it, but only if the integral runs from a − ½ to b + ½ (the continuity correction, dashed gold lines); integrating from a to b (grey lines) cuts half a bar off each end. Compare the three numbers in the table, check the rule of thumb, and try a skewed case (small p) to see an approximation that stays poor even with the correction.
The exact probability is a sum of binomial terms (logarithms of factorials and a recursion, no simulation). The rule of thumb of the book asks n > 9p/(1 − p) and n > 9(1 − p)/p. Relative error is (approximation − exact)/exact.
code/ch04_special_distributions.py (binom_normal).