1%feature("docstring") OT::Binomial
2"Binomial distribution.
3
4Available constructors:
5    Binomial(*n=1, p=0.5*)
6
7Parameters
8----------
9n : int, :math:`n \in \Nset`
10    The number of Bernoulli trials.
11p : float, :math:`0 \leq p \leq 1`
12    The success probability of the Bernoulli trial.
13
14Notes
15-----
16Its probability density function is defined as:
17
18.. math::
19
20    \Prob{X = k} = C_n^k p^k (1-p)^{n-k},
21                   \quad \forall k \in \{0, \ldots, n\}
22
23with :math:`n \in \Nset` and :math:`0 \leq p \leq 1`. It is evaluated using  Loader's algorithm, the *fast* and *accurate* method described in [loader2000]_, with the further improvements mentioned in [dimitriadis2016]_, see :meth:`~openturns.DistFunc_dBinomial`.
24
25Its first moments are:
26
27.. math::
28    :nowrap:
29
30    \begin{eqnarray*}
31        \Expect{X} & = & n\,p \\
32        \Var{X} & = & n\,p\,(1-p)
33    \end{eqnarray*}
34
35The sampling is done using the rejection algorithm described in [hormann1993]_, see :meth:`~openturns.DistFunc_rBinomial`.
36
37See Also
38--------
39Bernoulli
40
41Examples
42--------
43Create a distribution:
44
45>>> import openturns as ot
46>>> distribution = ot.Binomial(10, 0.5)
47
48Draw a sample:
49
50>>> sample = distribution.getSample(5)"
51
52// ---------------------------------------------------------------------
53
54%feature("docstring") OT::Binomial::getP
55"Accessor to the success probability parameter.
56
57Returns
58-------
59p : float
60    The success probability of the Bernoulli trial."
61
62// ---------------------------------------------------------------------
63
64%feature("docstring") OT::Binomial::getN
65"Accessor to the number of trials.
66
67Returns
68-------
69n : int
70    The number of Bernoulli trials."
71
72// ---------------------------------------------------------------------
73
74%feature("docstring") OT::Binomial::setP
75"Accessor to the success probability parameter.
76
77Parameters
78----------
79p : float, :math:`0 \leq p \leq 1`
80    The success probability of the Bernoulli trial."
81
82// ---------------------------------------------------------------------
83
84%feature("docstring") OT::Binomial::setN
85"Accessor to the number of trials.
86
87Parameters
88----------
89n : int, :math:`n \in \Nset`
90    The number of Bernoulli trials."
91