/** Plot the binomial function's density function and cumulative distribution function. */ use statistics.frink println[binomialProbability[55,100,1/2]-binomialProbability[45,100,1/2]] /** n is number of trials, p is probability of success on a single trial. */ plotBinomial[g is graphics, n, p] := { for k=0 to n { d = binomialDensity[k,n,p] pp = binomialProbability[k,n,p] g.fillRectSides[k/n,-d,(k+1)/n,0] g.line[k/n,-pp,(k+1)/n,-pp] } } g = new graphics plotBinomial[g, 800, 1/2] g.show[]