Sample Probability Calculations
The cumulative distribution function (CDF) may be used to compute probabilities for binomial distributions. The CDF of the Binomial(10,0.5) is shown below.
> restart: with(plots):
> n:=10: p:=0.5:
> PlotDiscCDF(BinomialPDF(n,p,x),0..10);
We can calculate probabilities for the Binomial( n,p ) distribution using either the probability distribution function (PDF) or the cumulative distribution function (CDF). We will denote the PDF by f and the CDF by F . We will consider these functions for a variable X having the Binomial(10,0.5) distribution.
> n:=10;
> p:=0.5;
> f:=x->BinomialPDF(n,p,x);
> F:=x->BinomialCDF(n,p,x);
Below you will find three different ways to calculate P( ) .
> evalf(f(0)+f(1)+f(2)+f(3));
> evalf(sum(f(x),x=0..3));
> evalf(F(3));