# This code produces a graph showing how the normal distribution approximates # the binomial distribution when n is large. Try various values of n and p. n <- 3 p <- 0.2 xs <- seq(from=0, to=n, by=1) plot(x=xs, y=sapply(xs, dbinom, n, p)) xs <- seq(from=0, to=n, by=0.1) par(new = TRUE) plot(x=xs, y=sapply(xs, dnorm, n * p, sqrt(n * p * (1 - p))), type="l", add=TRUE) # Yes, I know that the axis labels end up ugly.