File: discrete_randint.rst

package info (click to toggle)
python-scipy 0.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 75,464 kB
  • ctags: 79,406
  • sloc: python: 143,495; cpp: 89,357; fortran: 81,650; ansic: 79,778; makefile: 364; sh: 265
file content (31 lines) | stat: -rw-r--r-- 1,234 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

.. _discrete-randint:

Discrete Uniform (randint) Distribution
=======================================

The discrete uniform distribution with parameters :math:`\left(a,b\right)` constructs a random variable that has an equal probability of being
any one of the integers in the half-open range :math:`[a,b)`. If :math:`a` is not given it is assumed to be zero and the only parameter is :math:`b`. Therefore,

.. math::
   :nowrap:

    \begin{eqnarray*}
        p\left(k,a,b\right) & = & \frac{1}{b-a} \quad a \leq k < b \\
        F\left(x;a,b\right) & = & \frac{\left\lfloor x\right\rfloor -a}{b-a} \quad a \leq x \leq b \\
        G\left(q;a,b\right) & = & \left\lceil q\left(b-a\right)+a\right\rceil \\
        \mu & = & \frac{b+a-1}{2}\\
        \mu_{2} & = & \frac{\left(b-a-1\right)\left(b-a+1\right)}{12}\\
        \gamma_{1} & = & 0 \\
        \gamma_{2} & = & -\frac{6}{5}\frac{\left(b-a\right)^{2}+1}{\left(b-a-1\right)\left(b-a+1\right)}.
    \end{eqnarray*}

.. math::
   :nowrap:

    \begin{eqnarray*}
        M\left(t\right) & = & \frac{1}{b-a}\sum_{k=a}^{b-1}e^{tk}\\
                        & = & \frac{e^{bt}-e^{at}}{\left(b-a\right)\left(e^{t}-1\right)}
    \end{eqnarray*}

Implementation: `scipy.stats.randint`