DiscreteUniform - Maple Help

Statistics[Distributions]

 DiscreteUniform
 discrete uniform distribution

 Calling Sequence DiscreteUniform(a, b) DiscreteUniformDistribution(a, b)

Parameters

 a - lower bound parameter b - upper bound parameter

Description

 • The discrete uniform distribution is a discrete probability distribution with probability function given by:

$f\left(t\right)=\left\{\begin{array}{cc}0& t

 subject to the following conditions:

$⌈a⌉\le ⌊b⌋$

 • Note that the DiscreteUniform command is inert and should be used in combination with the RandomVariable command.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $X≔\mathrm{RandomVariable}\left(\mathrm{DiscreteUniform}\left(a,b\right)\right):$
 > $\mathrm{ProbabilityFunction}\left(X,u\right)$
 $\left\{\begin{array}{cc}{0}& {u}{<}{a}\\ \frac{{1}}{⌊{b}⌋{-}⌈{a}⌉{+}{1}}& {u}{\le }{b}\\ {0}& {\mathrm{otherwise}}\end{array}\right\$ (1)
 > $\mathrm{ProbabilityFunction}\left(X,4\right)$
 $\left\{\begin{array}{cc}{0}& {4}{<}{a}\\ \frac{{1}}{⌊{b}⌋{-}⌈{a}⌉{+}{1}}& {4}{\le }{b}\\ {0}& {\mathrm{otherwise}}\end{array}\right\$ (2)
 > $\mathrm{Mean}\left(X\right)$
 $\frac{⌈{a}⌉}{{2}}{+}\frac{⌊{b}⌋}{{2}}$ (3)

The variance of $X$ is a somewhat messy expression, because of all the $\mathrm{ceil}$ and $\mathrm{floor}$ functions.

 > $\mathrm{Variance}\left(X\right)$
 $\frac{{⌈{a}⌉}^{{2}}}{{12}}{+}\frac{{⌊{b}⌋}^{{2}}}{{12}}{+}\frac{⌊{b}⌋}{{6}}{-}\frac{⌈{a}⌉{}⌊{b}⌋}{{6}}{-}\frac{⌈{a}⌉}{{6}}$ (4)

If we know that $a$ and $b$ are integers, we can apply these assumptions to make the expression easier to read.

 > $\mathrm{Variance}\left(X\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}a::'\mathrm{integer}',b::'\mathrm{integer}'$
 $\frac{{1}}{{12}}{}{{a}}^{{2}}{+}\frac{{1}}{{12}}{}{{b}}^{{2}}{+}\frac{{1}}{{6}}{}{b}{-}\frac{{1}}{{6}}{}{a}{}{b}{-}\frac{{1}}{{6}}{}{a}$ (5)

References

 Evans, Merran; Hastings, Nicholas; and Peacock, Brian. Statistical Distributions. 3rd ed. Hoboken: Wiley, 2000.
 Johnson, Norman L.; Kotz, Samuel; and Balakrishnan, N. Continuous Univariate Distributions. 2nd ed. 2 vols. Hoboken: Wiley, 1995.
 Stuart, Alan, and Ord, Keith. Kendall's Advanced Theory of Statistics. 6th ed. London: Edward Arnold, 1998. Vol. 1: Distribution Theory.