Sample Probability Calculations
The following Maple code will make a plot of the cumulative distribution function of X, where X is a discrete uniform random variable on the set {1,2,3,4,5,6}.
>
> plot(floor(x)/6,x=0..6.5,color=blue,discont=true);
We can calculate probabilities for the Discrete Uniform ( N ) 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 . The value of N is set at 20, but you are encouraged to try other values of N .
> N:=20;
> f:=x->1/N;
> F:=x->floor(x)/N;
Below you will find three different ways to calculate P(4<= X <= 8).
> evalf(f(4)+f(5)+f(6)+f(7)+f(8));
> evalf(sum(f(x),x=4..8));
> evalf(F(8)-F(3));
>