+
    0i3                       ^ RI Ht ^ RIHt ^ RIHtHtHtHt	 ^ RI
Hu Ht ^ RIHt ^ RIHu Ht ^ RIHt ^ RIHtHtHtHtHtHtHtHtHtHt ^ RIt ^RI!H"t"H#t#H$t$H%t%H&t&H't' ^R	I(H)t)H*t*H+t+ ^R
I,H-t-  ! R R]"4      t.].! RR7      t/ ! R R].4      t0]0! ^RR7      t1 ! R R]"4      t2]2! RR7      t3 ! R R]"4      t4]4! RR7      t5 ! R R]"4      t6]6! RR7      t7 ! R R]"4      t8]8! ^RRR 7      t9 ! R! R"]"4      t:]:! R#R7      t; ! R$ R%]"4      t<]<! R&R7      t= ! R' R(]"4      t>]>! ^R)R*R 7      t? ! R+ R,]"4      t@]@! R-R.R/7      tA ! R0 R1]"4      tB]B! ^ R2R3R 7      tC ! R4 R5]"4      tD]D! R6^ R7R87      tE ! R9 R:]"4      tF]F! R;R<R/7      tG ! R= R>]"4      tH]H! ^R?R@R 7      tI ! RA RB]"4      tJ]J! ^RCRDR 7      tK ! RE RF]"4      tL]L! ] P                  ) RGRHR 7      tN ! RI RJ]"4      tO]O! RKRLRMRN7      tPRfRO ltQRgRP ltRRhRQ ltS]P]OutTtU]QP                  ]T]U4      ]PnQ        ]RP                  ]T]U4      ]PnR        ]SP                  ]T]U4      ]PnS         ! RR RS]'4      tW ! RT RU]"4      tX]X! ] P                  ) RVRWR 7      tY ! RX RY]"4      tZ]Z! RZ^R[7      t[ ! R\ R]]"4      t\ ! R^ R_]\4      t]]]! R`RaR/7      t^ ! Rb Rc]\4      t_]_! RdReR/7      t`]a! ]b! 4       P                  4       P                  4       4      te]#! ]e]"4      w  tftg]f]g,           thR# )i    )partial)special)entr	logsumexpbetalngammalnN)rng_integers)interp1d)
floorceillogexpsqrtlog1pexpm1tanhcoshsinh)rv_discreteget_distribution_names_vectorize_rvs_over_shapes
_ShapeInfo_isintegralrv_discrete_frozen)_PyFishersNCHypergeometric_PyWalleniusNCHypergeometric_PyStochasticLib3)_poisson_binomc                   t   a  ] tR t^t o RtR tRR ltR tR tR t	R t
R	 tR
 tR tR tRR ltR tRtV tR# )	binom_gena  A binomial discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `binom` is:

.. math::

   f(k) = \binom{n}{k} p^k (1-p)^{n-k}

for :math:`k \in \{0, 1, \dots, n\}`, :math:`0 \leq p \leq 1`

`binom` takes :math:`n` and :math:`p` as shape parameters,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

This distribution uses routines from the Boost Math C++ library for
the computation of the ``pmf``, ``cdf``, ``sf``, ``ppf`` and ``isf``
methods. [1]_

%(after_notes)s

References
----------
.. [1] The Boost Developers. "Boost C++ Libraries". https://www.boost.org/.

%(example)s

See Also
--------
hypergeom, nbinom, nhypergeom

c                Z    \        R R^ \        P                  3R4      \        RRRR4      .# nTFpTFr      TTr   npinfselfs   &Z/var/www/html/photoedit/myenv/lib/python3.14/site-packages/scipy/stats/_discrete_distns.py_shape_infobinom_gen._shape_info@   0    3q"&&k=A3v|<> 	>    Nc                &    VP                  WV4      # N)binomialr-   r#   r$   sizerandom_states   &&&&&r.   _rvsbinom_gen._rvsD   s    $$Q400r2   c                T    V^ 8  \        V4      ,          V^ 8  ,          V^8*  ,          # r   r   r-   r#   r$   s   &&&r.   	_argcheckbinom_gen._argcheckG   s'    Q+a.(AF3qAv>>r2   c                    V P                   V3# r4   ar>   s   &&&r.   _get_supportbinom_gen._get_supportJ   s    vvqyr2   c                $   \        V4      p\        V^,           4      \        V^,           4      \        W$,
          ^,           4      ,           ,
          pV\        P                  ! WC4      ,           \        P                  ! W$,
          V) 4      ,           # r'   )r   gamlnr   xlogyxlog1py)r-   xr#   r$   kcombilns   &&&&  r.   _logpmfbinom_gen._logpmfM   s\    !H1:qseACEl!:;q,,wqsQB/GGGr2   c                0    \         P                  ! WV4      # r4   )scu
_binom_pmfr-   rK   r#   r$   s   &&&&r.   _pmfbinom_gen._pmfR   s    ~~aA&&r2   c                F    \        V4      p\        P                  ! WBV4      # r4   )r   rQ   
_binom_cdfr-   rK   r#   r$   rL   s   &&&& r.   _cdfbinom_gen._cdfV       !H~~aA&&r2   c                F    \        V4      p\        P                  ! WBV4      # r4   )r   rQ   	_binom_sfrX   s   &&&& r.   _sfbinom_gen._sfZ   s    !H}}Q1%%r2   c                0    \         P                  ! WV4      # r4   )rQ   
_binom_isfrS   s   &&&&r.   _isfbinom_gen._isf^       ~~aA&&r2   c                0    \         P                  ! WV4      # r4   )rQ   
_binom_ppfr-   qr#   r$   s   &&&&r.   _ppfbinom_gen._ppfa   rd   r2   c                   W,          pWA\         P                  ! V4      ,          ,
          pR R rvRV9   dh   V\         P                  ! V4      ,
          p\         P                  ! W,          4      p	\         P                  ! V	4      p
RV,          V	,          pW,
          pRV9   dM   V\         P                  ! V4      ,
          pW,          p\         P                  ! V4      p
RV,          pW,
          pWEWg3# )Ns       @rL         @)r*   squarer   
reciprocal)r-   r#   r$   momentsmuvarg1g2pqnpq_sqrtt1t2npqs   &&&&         r.   _statsbinom_gen._statsd   s    Uryy|##tB'>RYYq\!BwwqvHx(B'X%BB'>RYYq\!B&Cs#BQBBr2   c                    \         P                  ^ V^,            pV P                  W1V4      p\         P                  ! \	        V4      ^ R7      # r   axis)r*   r_rT   sumr   )r-   r#   r$   rL   valss   &&&  r.   _entropybinom_gen._entropyv   s:    EE!AENyyq!vvd4jq))r2    NNmv__name__
__module____qualname____firstlineno____doc__r/   r9   r?   rD   rN   rT   rY   r^   rb   ri   r{   r   __static_attributes____classdictcell____classdict__s   @r.   r    r       sM     "F>1?H
''&''$* *r2   r    binom)namec                   p   a  ] tR t^t o RtR tRR ltR tR tR t	R t
R	 tR
 tR tR tR tR tRtV tR# )bernoulli_gena  A Bernoulli discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `bernoulli` is:

.. math::

   f(k) = \begin{cases}1-p  &\text{if } k = 0\\
                       p    &\text{if } k = 1\end{cases}

for :math:`k` in :math:`\{0, 1\}`, :math:`0 \leq p \leq 1`

`bernoulli` takes :math:`p` as shape parameter,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

%(after_notes)s

%(example)s

c                     \        R RRR4      .# r$   Fr&   r(   r   r,   s   &r.   r/   bernoulli_gen._shape_info       3v|<==r2   Nc                4    \         P                  V ^WVR7      # )r'   r7   r8   )r    r9   r-   r$   r7   r8   s   &&&&r.   r9   bernoulli_gen._rvs   s    ~~dAq,~OOr2   c                     V^ 8  V^8*  ,          # r<   r   r-   r$   s   &&r.   r?   bernoulli_gen._argcheck   s    Q16""r2   c                2    V P                   V P                  3# r4   )rC   br   s   &&r.   rD   bernoulli_gen._get_support   s    vvtvv~r2   c                0    \         P                  V^V4      # rG   )r   rN   r-   rK   r$   s   &&&r.   rN   bernoulli_gen._logpmf   s    }}Q1%%r2   c                0    \         P                  V^V4      # rG   )r   rT   r   s   &&&r.   rT   bernoulli_gen._pmf   s     zz!Q""r2   c                0    \         P                  V^V4      # rG   )r   rY   r   s   &&&r.   rY   bernoulli_gen._cdf       zz!Q""r2   c                0    \         P                  V^V4      # rG   )r   r^   r   s   &&&r.   r^   bernoulli_gen._sf   s    yyAq!!r2   c                0    \         P                  V^V4      # rG   )r   rb   r   s   &&&r.   rb   bernoulli_gen._isf   r   r2   c                0    \         P                  V^V4      # rG   )r   ri   )r-   rh   r$   s   &&&r.   ri   bernoulli_gen._ppf   r   r2   c                .    \         P                  ^V4      # rG   )r   r{   r   s   &&r.   r{   bernoulli_gen._stats   s    ||Aq!!r2   c                F    \        V4      \        ^V,
          4      ,           # rG   )r   r   s   &&r.   r   bernoulli_gen._entropy   s    Awac""r2   r   r   r   r   s   @r.   r   r      sL     0>P#&#
#"##"# #r2   r   	bernoulli)r   r   c                   V   a  ] tR t^t o RtR tRR ltR tR tR t	R t
RR	 ltR
tV tR# )betabinom_gena  A beta-binomial discrete random variable.

%(before_notes)s

Notes
-----
The beta-binomial distribution is a binomial distribution with a
probability of success `p` that follows a beta distribution.

The probability mass function for `betabinom` is:

.. math::

   f(k) = \binom{n}{k} \frac{B(k + a, n - k + b)}{B(a, b)}

for :math:`k \in \{0, 1, \dots, n\}`, :math:`n \geq 0`, :math:`a > 0`,
:math:`b > 0`, where :math:`B(a, b)` is the beta function.

`betabinom` takes :math:`n`, :math:`a`, and :math:`b` as shape parameters.

%(after_notes)s

References
----------
.. [1] https://en.wikipedia.org/wiki/Beta-binomial_distribution

.. versionadded:: 1.4.0

See Also
--------
beta, binom

%(example)s

c                    \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      \        RR^ \        P                  3R4      .# r#   TFrC   r   r%   FFr)   r,   s   &r.   r/   betabinom_gen._shape_info   P    3q"&&k=A3266{NC3266{NCE 	Er2   Nc                J    VP                  W#V4      pVP                  WV4      # r4   )betar5   r-   r#   rC   r   r7   r8   r$   s   &&&&&& r.   r9   betabinom_gen._rvs   s'    aD)$$Q400r2   c                
    ^ V3# r<   r   r-   r#   rC   r   s   &&&&r.   rD   betabinom_gen._get_support       !tr2   c                T    V^ 8  \        V4      ,          V^ 8  ,          V^ 8  ,          # r<   r=   r   s   &&&&r.   r?   betabinom_gen._argcheck   '    Q+a.(AE2a!e<<r2   c                    \        V4      p\        V^,           4      ) \        W%,
          ^,           V^,           4      ,
          pV\        WS,           W%,
          V,           4      ,           \        W44      ,
          # rG   )r   r   r   r-   rK   r#   rC   r   rL   rM   s   &&&&&  r.   rN   betabinom_gen._logpmf   sS    !Hq1u:+quqy!a% 88quqy11F1L@@r2   c                8    \        V P                  WW44      4      # r4   r   rN   r-   rK   r#   rC   r   s   &&&&&r.   rT   betabinom_gen._pmf       4<<a+,,r2   c                L   W"V,           ,          p^V,
          pW,          pWV,           V,           ,          V,          V,          W#,           ^,           ,          pRRrRV9   d`   R\        V4      ,          p	WV,           ^V,          ,           W2,
          ,          ,          p	WV,           ^,           W#,           ,          ,          p	RV9   EdY   W#,           P                  VP                  4      p
WV,           ^,
          ^V,          ,           ,          p
V
^V,          V,          V^,
          ,          ,          p
V
^V^,          ,          ,          p
V
^V,          V,          V,          ^V,
          ,          ,          p
V
^V,          V,          V^,          ,          ,          p
WV,           ^,          ^V,           V,           ,          ,          p
WV,          V,          W#,           ^,           ,          W#,           ^,           ,          W#,           V,           ,          ,          p
V
^,          p
WxW3# )r'   Nrl         ?rL   )r   astypedtype)r-   r#   rC   r   rq   e_pe_qrr   rs   rt   ru   s   &&&&&      r.   r{   betabinom_gen._stats   s   q5k#gWq519o#c)QUQY7tB'>tCyBq51q5=QU++Bq519''B'>%		*Bq519q1u$%B!a%!)q1u%%B!a1f*B!c'A+/QU++B"s(S.16))Bq5Q,!a%!),,Bq519	*aeai8AEAIFGB!GBr2   r   r   r   )r   r   r   r   r   r/   r9   rD   r?   rN   rT   r{   r   r   r   s   @r.   r   r      s5     "FE
1=A
- r2   r   	betabinomc                   j   a  ] tR tRt o RtR tRR ltR tR tR t	R	 t
R
 tR tR tR tR tRtV tR# )
nbinom_geni  a?  A negative binomial discrete random variable.

%(before_notes)s

Notes
-----
Negative binomial distribution describes a sequence of i.i.d. Bernoulli
trials, repeated until a predefined, non-random number of successes occurs.

The probability mass function of the number of failures for `nbinom` is:

.. math::

   f(k) = \binom{k+n-1}{n-1} p^n (1-p)^k

for :math:`k \ge 0`, :math:`0 < p \leq 1`

`nbinom` takes :math:`n` and :math:`p` as shape parameters where :math:`n`
is the number of successes, :math:`p` is the probability of a single
success, and :math:`1-p` is the probability of a single failure.

Another common parameterization of the negative binomial distribution is
in terms of the mean number of failures :math:`\mu` to achieve :math:`n`
successes. The mean :math:`\mu` is related to the probability of success
as

.. math::

   p = \frac{n}{n + \mu}

The number of successes :math:`n` may also be specified in terms of a
"dispersion", "heterogeneity", or "aggregation" parameter :math:`\alpha`,
which relates the mean :math:`\mu` to the variance :math:`\sigma^2`,
e.g. :math:`\sigma^2 = \mu + \alpha \mu^2`. Regardless of the convention
used for :math:`\alpha`,

.. math::

   p &= \frac{\mu}{\sigma^2} \\
   n &= \frac{\mu^2}{\sigma^2 - \mu}

This distribution uses routines from the Boost Math C++ library for
the computation of the ``pmf``, ``cdf``, ``sf``, ``ppf``, ``isf``
and ``stats`` methods. [1]_

%(after_notes)s

References
----------
.. [1] The Boost Developers. "Boost C++ Libraries". https://www.boost.org/.

%(example)s

See Also
--------
hypergeom, binom, nhypergeom

c                Z    \        R R^ \        P                  3R4      \        RRRR4      .# r"   r)   r,   s   &r.   r/   nbinom_gen._shape_infoS  r1   r2   Nc                &    VP                  WV4      # r4   )negative_binomialr6   s   &&&&&r.   r9   nbinom_gen._rvsW  s    --aD99r2   c                4    V^ 8  V^ 8  ,          V^8*  ,          # r<   r   r>   s   &&&r.   r?   nbinom_gen._argcheckZ  s    A!a% AF++r2   c                0    \         P                  ! WV4      # r4   )rQ   _nbinom_pmfrS   s   &&&&r.   rT   nbinom_gen._pmf]  s    qQ''r2   c                    \        W!,           4      \        V^,           4      ,
          \        V4      ,
          pWB\        V4      ,          ,           \        P                  ! W) 4      ,           # rG   )rH   r   r   rJ   )r-   rK   r#   r$   coeffs   &&&& r.   rN   nbinom_gen._logpmfa  sD    ac
U1Q3Z'%(2Qx'//!R"888r2   c                F    \        V4      p\        P                  ! WBV4      # r4   )r   rQ   _nbinom_cdfrX   s   &&&& r.   rY   nbinom_gen._cdfe  s    !HqQ''r2   c                |   \        V4      p\        P                  ! WBV4      w  rBpV P                  WBV4      pVR 8  pR pTp\        P                  ! RR7      ;_uu_ 4        V! WF,          W&,          W6,          4      W&   \        P
                  ! WV( ,          4      W( &   RRR4       V#   + '       g   i     T# ; i)      ?c                 x    \         P                  ! \        P                  ! V ^,           V^V,
          4      ) 4      # rG   )r*   r   r   betainc)rL   r#   r$   s   &&&r.   f1nbinom_gen._logcdf.<locals>.f1n  s)    88W__QUAq1u==>>r2   ignore)divideN)r   r*   broadcast_arraysrY   errstater   )	r-   rK   r#   r$   rL   cdfcondr   logcdfs	   &&&&     r.   _logcdfnbinom_gen._logcdfi  s    !H%%aA.aiia Sy	? [[))agqw8FLFF3u:.F5M *  *) s   !?B**B;	c                F    \        V4      p\        P                  ! WBV4      # r4   )r   rQ   
_nbinom_sfrX   s   &&&& r.   r^   nbinom_gen._sfx  r[   r2   c                    \         P                  ! R R7      ;_uu_ 4        \        P                  ! WV4      uuRRR4       #   + '       g   i     R# ; ir   overN)r*   r   rQ   _nbinom_isfrS   s   &&&&r.   rb   nbinom_gen._isf|  .    [[h''??1+ ('''   AA	c                    \         P                  ! R R7      ;_uu_ 4        \        P                  ! WV4      uuRRR4       #   + '       g   i     R# ; ir  )r*   r   rQ   _nbinom_ppfrg   s   &&&&r.   ri   nbinom_gen._ppf  r  r  c                    \         P                  ! W4      \         P                  ! W4      \         P                  ! W4      \         P                  ! W4      3# r4   )rQ   _nbinom_mean_nbinom_variance_nbinom_skewness_nbinom_kurtosis_excessr>   s   &&&r.   r{   nbinom_gen._stats  sD    Q"  &  &''-	
 	
r2   r   r   )r   r   r   r   r   r/   r9   r?   rT   rN   rY   r   r^   rb   ri   r{   r   r   r   s   @r.   r   r     sG     9t>:,(9(',,
 
r2   r   nbinomc                   P   a  ] tR tRt o RtR tRR ltR tR tR t	RR	 lt
R
tV tR# )betanbinom_geni  a  A beta-negative-binomial discrete random variable.

%(before_notes)s

Notes
-----
The beta-negative-binomial distribution is a negative binomial
distribution with a probability of success `p` that follows a
beta distribution.

The probability mass function for `betanbinom` is:

.. math::

   f(k) = \binom{n + k - 1}{k} \frac{B(a + n, b + k)}{B(a, b)}

for :math:`k \ge 0`, :math:`n \geq 0`, :math:`a > 0`,
:math:`b > 0`, where :math:`B(a, b)` is the beta function.

`betanbinom` takes :math:`n`, :math:`a`, and :math:`b` as shape parameters.

%(after_notes)s

References
----------
.. [1] https://en.wikipedia.org/wiki/Beta_negative_binomial_distribution

.. versionadded:: 1.12.0

See Also
--------
betabinom : Beta binomial distribution

%(example)s

c                    \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      \        RR^ \        P                  3R4      .# r   r)   r,   s   &r.   r/   betanbinom_gen._shape_info  r   r2   Nc                J    VP                  W#V4      pVP                  WV4      # r4   )r   r   r   s   &&&&&& r.   r9   betanbinom_gen._rvs  s'    aD)--aD99r2   c                T    V^ 8  \        V4      ,          V^ 8  ,          V^ 8  ,          # r<   r=   r   s   &&&&r.   r?   betanbinom_gen._argcheck  r   r2   c                    \        V4      p\        P                  ! W%,           4      ) \        W%^,           4      ,
          pV\        W2,           WE,           4      ,           \        W44      ,
          # rG   )r   r*   r   r   r   s   &&&&&  r.   rN   betanbinom_gen._logpmf  sI    !H66!%=.6!U#33qu--q<<r2   c                8    \        V P                  WW44      4      # r4   r   r   s   &&&&&r.   rT   betanbinom_gen._pmf  r   r2   c                   R  p\         P                  ! V^8  WV3V\        P                  R7      pR p\         P                  ! V^8  WV3V\        P                  R7      pRRrR p
RV9   d.   \         P                  ! V^8  WV3V
\        P                  R7      pR pRV9   d.   \         P                  ! V^8  WV3V\        P                  R7      p	WgW3# )c                 .    W,          VR ,
          ,          # r   r   r#   rC   r   s   &&&r.   mean#betanbinom_gen._stats.<locals>.mean  s    5AF##r2   
fill_valuec                     W,          W,           R ,
          ,          W,           R ,
          ,          VR,
          VR ,
          R,          ,          ,          # )r   rm   r   r!  s   &&&r.   rs   "betanbinom_gen._stats.<locals>.var  s;    EQURZ(AEBJ7B1r6B,.0 1r2   Nc                    ^V ,          V,           R,
          ^V,          V,           R,
          ,          VR,
          ,          \        W,          W,           R,
          ,          W!,           R,
          ,          VR,
          ,          4      ,          # )   r         @rm   r   r!  s   &&&r.   skew#betanbinom_gen._stats.<locals>.skew  sf    UQY^A	B72v!%aequrz&:aebj&I2v' "   !r2   rl   c                 T   VR ,
          pVR,
          R ,          VR ,          V^V,          R,
          ,          ,           RVR,
          ,          V,          ,           ,          RV R ,          ,          VR,           VR ,          ,          VR,           VR,
          ,          V,          ,           R VR,
          ^,          ,          ,           ,          ,           ^VR,
          ,          V ,          VR,           VR ,          ,          VR,           VR,
          ,          V,          ,           R VR,
          R ,          ,          ,           ,          ,           pVR,
          VR,
          ,          V,          V ,          W,           R,
          ,          W,           R,
          ,          pW4,          V,          R,
          # )rm   r   rn   r*        @g      @r   )r#   rC   r   termterm_2denominators   &&&   r.   kurtosis'betanbinom_gen._stats.<locals>.kurtosis  sH   FD2vlaea1q52:.>&>a"f)'* +QU
q2vB&6!b&R:!#$:% '%')QVaK'7'8 99 QVq(b&ArE)QVB,?!,CCa"fr\)*+	+F Fq2v.2Q6ebj*-.URZ9K =;.33r2   rL   xpxapply_wherer*   r+   )r-   r#   rC   r   rq   r"  rr   rs   rt   ru   r,  r3  s   &&&&&       r.   r{   betanbinom_gen._stats  s    	$__QUQ1ItG	1 ooa!eaAYGtB	! '>Qq	4BFFKB	4 '>Qq	8OBr2   r   r   r   )r   r   r   r   r   r/   r9   r?   rN   rT   r{   r   r   r   s   @r.   r  r    s/     #HE
:==
-! !r2   r  
betanbinomc                   j   a  ] tR tRt o RtR tRR ltR tR tR t	R	 t
R
 tR tR tR tR tRtV tR# )geom_geni  a  A geometric discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `geom` is:

.. math::

    f(k) = (1-p)^{k-1} p

for :math:`k \ge 1`, :math:`0 < p \leq 1`

`geom` takes :math:`p` as shape parameter,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

Note that when drawing random samples, the probability of observations that exceed
``np.iinfo(np.int64).max`` increases rapidly as $p$ decreases below $10^{-17}$. For
$p < 10^{-20}$, almost all observations would exceed the maximum ``int64``; however,
the output dtype is always ``int64``, so these values are clipped to the maximum.

%(after_notes)s

See Also
--------
planck

%(example)s

c                     \        R RRR4      .# r   r   r,   s   &r.   r/   geom_gen._shape_info  r   r2   Nc                    VP                  WR 7      p\        P                  ! VP                  4      P                  p\        P
                  ! V^ 8  WT4      # r7   )	geometricr*   iinfor   maxwhere)r-   r$   r7   r8   resmax_ints   &&&&  r.   r9   geom_gen._rvs  sD    $$Q$2 ((399%))xxa..r2   c                     V^8*  V^ 8  ,          # rG   r   r   s   &&r.   r?   geom_gen._argcheck  s    Q1q5!!r2   c                Z    \         P                  ! ^V,
          V^,
          4      V,          # rG   )r*   powerr-   rL   r$   s   &&&r.   rT   geom_gen._pmf  s     xx!QqS!A%%r2   c                `    \         P                  ! V^,
          V) 4      \        V4      ,           # rG   )r   rJ   r   rL  s   &&&r.   rN   geom_gen._logpmf"  s"    q1uqb)CF22r2   c                R    \        V4      p\        \        V) 4      V,          4      ) # r4   )r   r   r   r-   rK   r$   rL   s   &&& r.   rY   geom_gen._cdf%  s#    !HeQBik"""r2   c                L    \         P                  ! V P                  W4      4      # r4   )r*   r   _logsfr   s   &&&r.   r^   geom_gen._sf)  s    vvdkk!'((r2   c                >    \        V4      pV\        V) 4      ,          # r4   )r   r   rQ  s   &&& r.   rT  geom_gen._logsf,  s    !Hr{r2   c                    \        \        V) 4      \        V) 4      ,          4      pV P                  V^,
          V4      p\        P                  ! WA8  V^ 8  ,          V^,
          V4      # rG   )r   r   rY   r*   rD  )r-   rh   r$   r   temps   &&&  r.   ri   geom_gen._ppf0  sS    E1"Iqb	)*yya#xxtax0$q&$??r2   c                    R V,          pR V,
          pW1,          V,          pRV,
          \        V4      ,          p\        P                  ! . ROV4      R V,
          ,          pW$WV3# )r   rm   )r'   i   )r   r*   polyval)r-   r$   rr   qrrs   rt   ru   s   &&     r.   r{   geom_gen._stats5  sT    UUfqj!etBxZZ
A&A.r2   c                    \         P                  ! V4      ) \         P                  ! V) 4      R V,
          ,          V,          ,
          # r   )r*   r   r   r   s   &&r.   r   geom_gen._entropy=  s/    q	zBHHaRLCE2Q666r2   r   r   )r   r   r   r   r   r/   r9   r?   rT   rN   rY   r^   rT  ri   r{   r   r   r   r   s   @r.   r;  r;    sH     B>/"&3#)@
7 7r2   r;  geomzA geometric)rC   r   longnamec                   p   a  ] tR tRt o RtR tRR ltR tR tR t	R	 t
R
 tR tR tR tR tR tRtV tR# )hypergeom_geniD  a?  A hypergeometric discrete random variable.

The hypergeometric distribution models drawing objects from a bin.
`M` is the total number of objects, `n` is total number of Type I objects.
The random variate represents the number of Type I objects in `N` drawn
without replacement from the total population.

%(before_notes)s

Notes
-----
The symbols used to denote the shape parameters (`M`, `n`, and `N`) are not
universally accepted.  See the Examples for a clarification of the
definitions used here.

The probability mass function is defined as,

.. math:: p(k, M, n, N) = \frac{\binom{n}{k} \binom{M - n}{N - k}}
                               {\binom{M}{N}}

for :math:`k \in [\max(0, N - M + n), \min(n, N)]`, where the binomial
coefficients are defined as,

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

This distribution uses routines from the Boost Math C++ library for
the computation of the ``pmf``, ``cdf``, ``sf`` and ``stats`` methods. [1]_

%(after_notes)s

References
----------
.. [1] The Boost Developers. "Boost C++ Libraries". https://www.boost.org/.

Examples
--------
>>> import numpy as np
>>> from scipy.stats import hypergeom
>>> import matplotlib.pyplot as plt

Suppose we have a collection of 20 animals, of which 7 are dogs.  Then if
we want to know the probability of finding a given number of dogs if we
choose at random 12 of the 20 animals, we can initialize a frozen
distribution and plot the probability mass function:

>>> [M, n, N] = [20, 7, 12]
>>> rv = hypergeom(M, n, N)
>>> x = np.arange(0, n+1)
>>> pmf_dogs = rv.pmf(x)

>>> fig = plt.figure()
>>> ax = fig.add_subplot(111)
>>> ax.plot(x, pmf_dogs, 'bo')
>>> ax.vlines(x, 0, pmf_dogs, lw=2)
>>> ax.set_xlabel('# of dogs in our group of chosen animals')
>>> ax.set_ylabel('hypergeom PMF')
>>> plt.show()

Instead of using a frozen distribution we can also use `hypergeom`
methods directly.  To for example obtain the cumulative distribution
function, use:

>>> prb = hypergeom.cdf(x, M, n, N)

And to generate random numbers:

>>> R = hypergeom.rvs(M, n, N, size=10)

See Also
--------
nhypergeom, binom, nbinom

c                    \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      \        RR^ \        P                  3R4      .# )MTr#   Nr%   r)   r,   s   &r.   r/   hypergeom_gen._shape_info  P    3q"&&k=A3q"&&k=A3q"&&k=AC 	Cr2   Nc                6    VP                  W!V,
          W4R 7      # r?  )hypergeometric)r-   rg  r#   rh  r7   r8   s   &&&&&&r.   r9   hypergeom_gen._rvs  s    **1c1*@@r2   c                v    \         P                  ! W1V,
          ,
          ^ 4      \         P                  ! W#4      3# r<   r*   maximumminimum)r-   rg  r#   rh  s   &&&&r.   rD   hypergeom_gen._get_support  s'    zz!qS'1%rzz!'777r2   c                    V^ 8  V^ 8  ,          V^ 8  ,          pWBV8*  W18*  ,          ,          pV\        V4      \        V4      ,          \        V4      ,          ,          pV# r<   r=   )r-   rg  r#   rh  r   s   &&&& r.   r?   hypergeom_gen._argcheck  sU    A!q&!Q!V,aAF##AQ/+a.@@r2   c                   Y#reWV,
          p\        V^,           ^4      \        V^,           ^4      ,           \        WT,
          ^,           V^,           4      ,           \        V^,           Wa,
          ^,           4      ,
          \        WA,
          ^,           Wt,
          V,           ^,           4      ,
          \        V^,           ^4      ,
          pV# rG   r   )	r-   rL   rg  r#   rh  totgoodbadresults	   &&&&&    r.   rN   hypergeom_gen._logpmf  s    Tja#fSUA&66a19MM1dfQh'(*0Qa	*BCQ"# r2   c                0    \         P                  ! WWB4      # r4   )rQ   _hypergeom_pmfr-   rL   rg  r#   rh  s   &&&&&r.   rT   hypergeom_gen._pmf      !!!--r2   c                0    \         P                  ! WWB4      # r4   )rQ   _hypergeom_cdfr~  s   &&&&&r.   rY   hypergeom_gen._cdf  r  r2   c                   R V,          R V,          R V,          r2pW,
          pW^,           ,          RV,          W,
          ,          ,
          RV,          V,          ,
          pWQ^,
          V,          V,          ,          pVRV,          V,          W,
          ,          V,          RV,          ^,
          ,          ,          pWRV,          W,
          ,          V,          VR,
          ,          VR,
          ,          ,          p\         P                  ! W#V4      \         P                  ! W#V4      \         P                  ! W#V4      V3# )r   rn   r/  rm   r*  )rQ   _hypergeom_mean_hypergeom_variance_hypergeom_skewness)r-   rg  r#   rh  mru   s   &&&&  r.   r{   hypergeom_gen._stats  s    q&"q&"q&aE a%[26QU++b1fqj8
1ukAo
b1fqjAE"Q&"q&1*55
!equo!QV,B77a(##A!,##A!,	
 	
r2   c                    \         P                  W1V,
          ,
          \        W#4      ^,            pV P                  WAW#4      p\         P                  ! \        V4      ^ R7      # )r'   r   )r*   r   minpmfr   r   )r-   rg  r#   rh  rL   r   s   &&&&  r.   r   hypergeom_gen._entropy  sE    EE!1u+c!i!m,xxa#vvd4jq))r2   c                0    \         P                  ! WWB4      # r4   )rQ   _hypergeom_sfr~  s   &&&&&r.   r^   hypergeom_gen._sf  s      q,,r2   c                   . p\        \        P                  ! WW44      !   F  w  rgrVR ,           VR ,           ,          VR ,
          V	R ,
          ,          8  d7   VP                  \	        \        V P                  WgW4      4      ) 4      4       Km  \        P                  ! V^,           V	^,           4      p
VP                  \        V P                  WW4      4      4       K  	  \        P                  ! V4      # r   )zipr*   r   appendr   r   r   aranger   rN   asarrayr-   rL   rg  r#   rh  rE  quantrw  rx  drawk2s   &&&&&      r.   rT  hypergeom_gen._logsf  s    &)2+>+>qQ+J&K"Ec	*dSjTCZ-HH

5#dkk%d&I"J!JKL YYuqy$(3

9T\\"4%FGH 'L zz#r2   c                   . p\        \        P                  ! WW44      !   F  w  rgrVR ,           VR ,           ,          VR ,
          V	R ,
          ,          8  d7   VP                  \	        \        V P                  WgW4      4      ) 4      4       Km  \        P                  ! ^ V^,           4      p
VP                  \        V P                  WW4      4      4       K  	  \        P                  ! V4      # r  )r  r*   r   r  r   r   logsfr  r   rN   r  r  s   &&&&&      r.   r   hypergeom_gen._logcdf  s    &)2+>+>qQ+J&K"Ec	*dSjTCZ-HH

5#djjT&H"I!IJK YYq%!),

9T\\"4%FGH 'L zz#r2   r   r   )r   r   r   r   r   r/   r9   rD   r?   rN   rT   rY   r{   r   r^   rT  r   r   r   r   s   @r.   re  re  D  sO     HRC
A8..
"*
-

 
r2   re  	hypergeomc                   R   a  ] tR tRt o RtR tR tR tRR ltR t	R	 t
R
 tRtV tR# )nhypergeom_geni  a>  A negative hypergeometric discrete random variable.

Consider a box containing :math:`M` balls:, :math:`n` red and
:math:`M-n` blue. We randomly sample balls from the box, one
at a time and *without* replacement, until we have picked :math:`r`
blue balls. `nhypergeom` is the distribution of the number of
red balls :math:`k` we have picked.

%(before_notes)s

Notes
-----
The symbols used to denote the shape parameters (`M`, `n`, and `r`) are not
universally accepted. See the Examples for a clarification of the
definitions used here.

The probability mass function is defined as,

.. math:: f(k; M, n, r) = \frac{{{k+r-1}\choose{k}}{{M-r-k}\choose{n-k}}}
                               {{M \choose n}}

for :math:`k \in [0, n]`, :math:`n \in [0, M]`, :math:`r \in [0, M-n]`,
and the binomial coefficient is:

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

It is equivalent to observing :math:`k` successes in :math:`k+r-1`
samples with :math:`k+r`'th sample being a failure. The former
can be modelled as a hypergeometric distribution. The probability
of the latter is simply the number of failures remaining
:math:`M-n-(r-1)` divided by the size of the remaining population
:math:`M-(k+r-1)`. This relationship can be shown as:

.. math:: NHG(k;M,n,r) = HG(k;M,n,k+r-1)\frac{(M-n-(r-1))}{(M-(k+r-1))}

where :math:`NHG` is probability mass function (PMF) of the
negative hypergeometric distribution and :math:`HG` is the
PMF of the hypergeometric distribution.

%(after_notes)s

Examples
--------
>>> import numpy as np
>>> from scipy.stats import nhypergeom
>>> import matplotlib.pyplot as plt

Suppose we have a collection of 20 animals, of which 7 are dogs.
Then if we want to know the probability of finding a given number
of dogs (successes) in a sample with exactly 12 animals that
aren't dogs (failures), we can initialize a frozen distribution
and plot the probability mass function:

>>> M, n, r = [20, 7, 12]
>>> rv = nhypergeom(M, n, r)
>>> x = np.arange(0, n+2)
>>> pmf_dogs = rv.pmf(x)

>>> fig = plt.figure()
>>> ax = fig.add_subplot(111)
>>> ax.plot(x, pmf_dogs, 'bo')
>>> ax.vlines(x, 0, pmf_dogs, lw=2)
>>> ax.set_xlabel('# of dogs in our group with given 12 failures')
>>> ax.set_ylabel('nhypergeom PMF')
>>> plt.show()

Instead of using a frozen distribution we can also use `nhypergeom`
methods directly.  To for example obtain the probability mass
function, use:

>>> prb = nhypergeom.pmf(x, M, n, r)

And to generate random numbers:

>>> R = nhypergeom.rvs(M, n, r, size=10)

To verify the relationship between `hypergeom` and `nhypergeom`, use:

>>> from scipy.stats import hypergeom, nhypergeom
>>> M, n, r = 45, 13, 8
>>> k = 6
>>> nhypergeom.pmf(k, M, n, r)
0.06180776620271643
>>> hypergeom.pmf(k, M, n, k+r-1) * (M - n - (r-1)) / (M - (k+r-1))
0.06180776620271644

See Also
--------
hypergeom, binom, nbinom

References
----------
.. [1] Negative Hypergeometric Distribution on Wikipedia
       https://en.wikipedia.org/wiki/Negative_hypergeometric_distribution

.. [2] Negative Hypergeometric Distribution from
       http://www.math.wm.edu/~leemis/chart/UDR/PDFs/Negativehypergeometric.pdf

c                    \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      \        RR^ \        P                  3R4      .# )rg  Tr#   rr%   r)   r,   s   &r.   r/   nhypergeom_gen._shape_infoG  rj  r2   c                
    ^ V3# r<   r   )r-   rg  r#   r  s   &&&&r.   rD   nhypergeom_gen._get_supportL  r   r2   c                    V^ 8  W!8*  ,          V^ 8  ,          W1V,
          8*  ,          pV\        V4      \        V4      ,          \        V4      ,          ,          pV# r<   r=   )r-   rg  r#   r  r   s   &&&& r.   r?   nhypergeom_gen._argcheckO  sK    Q16"a1f-c:AQ/+a.@@r2   Nc                8   a  \         V 3R  l4       pV! WW4VR7      # )c                 (  < SP                  WV4      w  rV\        P                  ! WV^,           4      pSP                  WpW4      p\	        WRRR7      p	V	! VP                  VR7      4      P                  \        4      p
Vf   V
P                  4       # V
# )r'   nextextrapolate)kindr%  r@  )	supportr*   r  r   r
   uniformr   intitem)rg  r#   r  r7   r8   rC   r   ksr   ppfrvsr-   s   &&&&&      r.   _rvs1"nhypergeom_gen._rvs.<locals>._rvs1V  s     <<a(DA1c"B((2!'C3MJCl***56==cBC|xxz!Jr2   r   r   )r-   rg  r#   r  r7   r8   r  s   f&&&&& r.   r9   nhypergeom_gen._rvsT  s&    	#		 
$		 Q1lCCr2   c                V    \         P                  ! V^ 8g  V^ 8g  ,          WW43R RR7      # )r   c                    \        V ^,           V4      ) \        W,           ^4      ,           \        W ,
          ^,           W,
          V,
          ^,           4      ,
          \        W,
          V ,
          ^,           ^4      ,           \        V^,           W,
          ^,           4      ,           \        V^,           ^4      ,
          # rG   rv  )rL   rg  r#   r  s   &&&&r.   <lambda>(nhypergeom_gen._logpmf.<locals>.<lambda>g  s    1a.6!#q>1!#a%Qq)*,213q57A,>?!A#qs1u%&(.qsA7r2           r$  )r6  r7  r-   rL   rg  r#   r  s   &&&&&r.   rN   nhypergeom_gen._logpmfd  s3    !VQ!8  	r2   c                8    \        V P                  WW44      4      # r4   r   r  s   &&&&&r.   rT   nhypergeom_gen._pmfm  s     4<<a+,,r2   c                <   R V,          R V,          R V,          r2pW2,          W,
          ^,           ,          pW1^,           ,          V,          W,
          ^,           W,
          ^,           ,          ,          ^W1V,
          ^,           ,          ,
          ,          pRRrvWEWg3# )r   Nr   )r-   rg  r#   r  rr   rs   rt   ru   s   &&&&    r.   r{   nhypergeom_gen._statsr  sv     Q$1bdaSACE]1gaiACEACE?+q1!A;? tBr2   r   r   )r   r   r   r   r   r/   rD   r?   r9   rN   rT   r{   r   r   r   s   @r.   r  r    s6     bHC

D -
 r2   r  
nhypergeomc                   L   a  ] tR tRt o RtR tRR ltR tR tR t	R	 t
R
tV tR# )
logser_geni  a  A Logarithmic (Log-Series, Series) discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `logser` is:

.. math::

    f(k) = - \frac{p^k}{k \log(1-p)}

for :math:`k \ge 1`, :math:`0 < p < 1`

`logser` takes :math:`p` as shape parameter,
where :math:`p` is the probability of a single success
and :math:`1-p` is the probability of a single failure.

%(after_notes)s

%(example)s

c                     \        R RRR4      .# r   r   r,   s   &r.   r/   logser_gen._shape_info  r   r2   Nc                &    VP                  WR 7      # r?  )	logseriesr   s   &&&&r.   r9   logser_gen._rvs  s     %%a%33r2   c                     V^ 8  V^8  ,          # r<   r   r   s   &&r.   r?   logser_gen._argcheck  s    A!a%  r2   c                    \         P                  ! W!4      ) R ,          V,          \        P                  ! V) 4      ,          # r   )r*   rK  r   r   rL  s   &&&r.   rT   logser_gen._pmf  s,    $q(7==!+<<<r2   c                    R p\         P                  ! V^,           W24      ) \         P                  ! V^,           V4      ,          \        P                  ! V) 4      ,          # )g0.++)r   r   r   r*   r   )r-   rL   r$   tinys   &&& r.   r^   logser_gen._sf  sF    
 !T--QqS$0GG"((TUSU,VVr2   c                P   \         P                  ! V) 4      pWR ,
          ,          V,          pV) V,          VR ,
          ^,          ,          pWCV,          ,
          pV) V,          R V,           ,          R V,
          ^,          ,          pV^V,          V,          ,
          ^V^,          ,          ,           pV\        P                  ! VR4      ,          pV) V,          R V^,
          ^,          ,          ^V,          V^,
          ^,          ,          ,
          ^V,          V,          V^,
          ^,          ,          ,           ,          p	V	^V,          V,          ,
          ^V,          V,          V,          ,           ^V^,          ,          ,
          p
W^,          ,          R,
          pW5W3# )r         ?r*  )r   r   r*   rK  )r-   r$   r  rr   mu2prs   mu3pmu3rt   mu4pmu4ru   s   &&          r.   r{   logser_gen._stats  s4   MM1"c']QrAvS1$UlrAvQ37Q,.QrT$Y2q5(288C%%rAv1Q3(NQqSAEA:--!A1q0@@BQtVBY42-"a%76\Cr2   r   r   )r   r   r   r   r   r/   r9   r?   rT   r^   r{   r   r   r   s   @r.   r  r    s.     0>4
!=W r2   r  logserzA logarithmicc                   ^   a  ] tR tRt o RtR tR tRR ltR tR t	R	 t
R
 tR tR tRtV tR# )poisson_geni  ag  A Poisson discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `poisson` is:

.. math::

    f(k) = \exp(-\mu) \frac{\mu^k}{k!}

for :math:`k \ge 0`.

`poisson` takes :math:`\mu \geq 0` as shape parameter.
When :math:`\mu = 0`, the ``pmf`` method
returns ``1.0`` at quantile :math:`k = 0`.

%(after_notes)s

%(example)s

c                @    \        R R^ \        P                  3R4      .# )rr   Fr%   r)   r,   s   &r.   r/   poisson_gen._shape_info  s    4BFF]CDDr2   c                    V^ 8  # r<   r   )r-   rr   s   &&r.   r?   poisson_gen._argcheck  s    Qwr2   Nc                $    VP                  W4      # r4   poisson)r-   rr   r7   r8   s   &&&&r.   r9   poisson_gen._rvs  s    ##B--r2   c                n    \         P                  ! W4      \        V^,           4      ,
          V,
          pV# rG   )r   rI   rH   )r-   rL   rr   Pks   &&& r.   rN   poisson_gen._logpmf  s'    ]]1!E!a%L025	r2   c                6    \        V P                  W4      4      # r4   r   )r-   rL   rr   s   &&&r.   rT   poisson_gen._pmf  s    4<<&''r2   c                D    \        V4      p\        P                  ! W24      # r4   )r   r   pdtrr-   rK   rr   rL   s   &&& r.   rY   poisson_gen._cdf  s    !H||A""r2   c                D    \        V4      p\        P                  ! W24      # r4   )r   r   pdtrcr  s   &&& r.   r^   poisson_gen._sf  s    !H}}Q##r2   c                    \        \        P                  ! W4      4      p\        P                  ! V^,
          ^ 4      p\        P
                  ! WB4      p\        P                  ! WQ8  WC4      # rG   )r   r   pdtrikr*   rp  r  rD  )r-   rh   rr   r   vals1rY  s   &&&   r.   ri   poisson_gen._ppf  sJ    GNN1)*

4!8Q'||E&xx	5//r2   c                    Tp\         P                  ! V4      pV^ 8  p\        P                  ! WCR \         P                  R7      p\        P                  ! WCR \         P                  R7      pWWV3# )r   c                 &    \        R V ,          4      # r   r+  rK   s   &r.   r  $poisson_gen._stats.<locals>.<lambda>  s    SUr2   r$  c                     R V ,          # r   r   r  s   &r.   r  r    s    Ar2   )r*   r  r6  r7  r+   )r-   rr   rs   tmp
mu_nonzerort   ru   s   &&     r.   r{   poisson_gen._stats   sW    jjn1W
__Z.CPRPVPVW__Zo"&&Qr2   r   r   )r   r   r   r   r   r/   r?   r9   rN   rT   rY   r^   ri   r{   r   r   r   s   @r.   r  r    s=     0E.(#$0 r2   r  r  z	A Poisson)r   rc  c                   d   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tRR ltR tR tRtV tR
# )
planck_geni  a  A Planck discrete exponential random variable.

%(before_notes)s

Notes
-----
The probability mass function for `planck` is:

.. math::

    f(k) = (1-\exp(-\lambda)) \exp(-\lambda k)

for :math:`k \ge 0` and :math:`\lambda > 0`.

`planck` takes :math:`\lambda` as shape parameter. The Planck distribution
can be written as a geometric distribution (`geom`) with
:math:`p = 1 - \exp(-\lambda)` shifted by ``loc = -1``.

%(after_notes)s

See Also
--------
geom

%(example)s

c                @    \        R R^ \        P                  3R4      .# )lambda_Fr   r)   r,   s   &r.   r/   planck_gen._shape_info(  s    9ea[.IJJr2   c                    V^ 8  # r<   r   )r-   r  s   &&r.   r?   planck_gen._argcheck+  s    {r2   c                L    \        V) 4      ) \        V) V,          4      ,          # r4   )r   r   )r-   rL   r  s   &&&r.   rT   planck_gen._pmf.  s     whWHQJ//r2   c                N    \        V4      p\        V) V^,           ,          4      ) # rG   )r   r   r-   rK   r  rL   s   &&& r.   rY   planck_gen._cdf1  s#    !Hwh!n%%%r2   c                6    \        V P                  W4      4      # r4   )r   rT  )r-   rK   r  s   &&&r.   r^   planck_gen._sf5  s    4;;q*++r2   c                :    \        V4      pV) V^,           ,          # rG   r   r  s   &&& r.   rT  planck_gen._logsf8  s    !Hx1~r2   c                    \        RV,          \        V) 4      ,          ^,
          4      pV^,
          P                  ! V P                  V4      !  pV P	                  WB4      p\
        P                  ! WQ8  WC4      # )r         )r   r   cliprD   rY   r*   rD  )r-   rh   r  r   r  rY  s   &&&   r.   ri   planck_gen._ppf<  s^    DL5!9,Q./a 1 1' :<yy(xx	5//r2   Nc                N    \        V) 4      ) pVP                  WBR 7      R,
          # )r@  r   )r   rA  )r-   r  r7   r8   r$   s   &&&& r.   r9   planck_gen._rvsB  s)    G8_%%a%3c99r2   c                    ^\        V4      ,          p\        V) 4      \        V) 4      ^,          ,          p^\        VR,          4      ,          p^^\        V4      ,          ,           pW#WE3# r'   rm   )r   r   r   )r-   r  rr   rs   rt   ru   s   &&    r.   r{   planck_gen._statsG  sZ    uW~7(mUG8_q00tGCK  qgr2   c                p    \        V) 4      ) pV\        V) 4      ,          V,          \        V4      ,
          # r4   )r   r   r   )r-   r  Cs   && r.   r   planck_gen._entropyN  s/    G8_sG8}$Q&Q//r2   r   r   )r   r   r   r   r   r/   r?   rT   rY   r^   rT  ri   r9   r{   r   r   r   r   s   @r.   r  r    sB     6K0&,0:
0 0r2   r  planckzA discrete exponential c                   N   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
tV tR# )boltzmann_geniV  ak  A Boltzmann (Truncated Discrete Exponential) random variable.

%(before_notes)s

Notes
-----
The probability mass function for `boltzmann` is:

.. math::

    f(k) = (1-\exp(-\lambda)) \exp(-\lambda k) / (1-\exp(-\lambda N))

for :math:`k = 0,..., N-1`.

`boltzmann` takes :math:`\lambda > 0` and :math:`N > 0` as shape parameters.

%(after_notes)s

%(example)s

c                z    \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      .# )r  Frh  Tr   r)   r,   s   &r.   r/   boltzmann_gen._shape_infol  s:    9ea[.I3q"&&k>BD 	Dr2   c                @    V^ 8  V^ 8  ,          \        V4      ,          # r<   r=   r-   r  rh  s   &&&r.   r?   boltzmann_gen._argcheckp  s    !A&Q77r2   c                ,    V P                   V^,
          3# rG   rB   r!  s   &&&r.   rD   boltzmann_gen._get_supports  s    vvq1u}r2   c                    ^\        V) 4      ,
          ^\        V) V,          4      ,
          ,          pV\        V) V,          4      ,          # rG   r   )r-   rL   r  rh  facts   &&&& r.   rT   boltzmann_gen._pmfv  s<     #wh-!C
O"34C
O##r2   c                    \        V4      p^\        V) V^,           ,          4      ,
          ^\        V) V,          4      ,
          ,          # rG   )r   r   )r-   rK   r  rh  rL   s   &&&& r.   rY   boltzmann_gen._cdf|  s9    !H#wh!n%%#whqj/(9::r2   c                H   V^\        V) V,          4      ,
          ,          p\        RV,          \        ^V,
          4      ,          ^,
          4      pV^,
          P                  R\        P
                  4      pV P                  WbV4      p\        P                  ! Wq8  We4      # )r'   r  r  )r   r   r   r  r*   r+   rY   rD  )r-   rh   r  rh  qnewr   r  rY  s   &&&&    r.   ri   boltzmann_gen._ppf  sv    !C
O#$DL3qv;.q01ac266*yy+xx	5//r2   c                "   \        V) 4      p\        V) V,          4      pVR V,
          ,          W$,          ^V,
          ,          ,
          pVR V,
          ^,          ,          W",          V,          ^V,
          ^,          ,          ,
          p^V,
          ^V,
          ,          pW7^,          ,          W",          V,          ,
          pV^V,           ,          V^,          ,          V^,          V,          ^V,           ,          ,
          p	WR,          ,          p	V^^V,          ,           W3,          ,           ,          V^,          ,          V^,          V,          ^^V,          ,           WD,          ,           ,          ,
          p
W,          V,          p
WVW3# )r   r  r&  )r-   r  rh  zzNrr   rs   trmtrm2rt   ru   s   &&&        r.   r{   boltzmann_gen._stats  s   M'!_AYqtQrT{"Q
lQSVQrTAI--taclq&13r6!!WS!V^ad2gqtn,+!A#ac	]36!AqD2Iq2vbe|$<<Yr2   r   N)r   r   r   r   r   r/   r?   rD   rT   rY   ri   r{   r   r   r   s   @r.   r  r  V  s3     *D8$;0 r2   r  	boltzmannz!A truncated discrete exponential )r   rC   rc  c                   ^   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tRR ltR tRtV tR
# )randint_geni  a+  A uniform discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `randint` is:

.. math::

    f(k) = \frac{1}{\texttt{high} - \texttt{low}}

for :math:`k \in \{\texttt{low}, \dots, \texttt{high} - 1\}`.

`randint` takes :math:`\texttt{low}` and :math:`\texttt{high}` as shape
parameters.

%(after_notes)s

Examples
--------
>>> import numpy as np
>>> from scipy.stats import randint
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots(1, 1)

Calculate the first four moments:

>>> low, high = 7, 31
>>> mean, var, skew, kurt = randint.stats(low, high, moments='mvsk')

Display the probability mass function (``pmf``):

>>> x = np.arange(low - 5, high + 5)
>>> ax.plot(x, randint.pmf(x, low, high), 'bo', ms=8, label='randint pmf')
>>> ax.vlines(x, 0, randint.pmf(x, low, high), colors='b', lw=5, alpha=0.5)

Alternatively, the distribution object can be called (as a function) to
fix the shape and location. This returns a "frozen" RV object holding the
given parameters fixed.

Freeze the distribution and display the frozen ``pmf``:

>>> rv = randint(low, high)
>>> ax.vlines(x, 0, rv.pmf(x), colors='k', linestyles='-',
...           lw=1, label='frozen pmf')
>>> ax.legend(loc='lower center')
>>> plt.show()

Check the relationship between the cumulative distribution function
(``cdf``) and its inverse, the percent point function (``ppf``):

>>> q = np.arange(low, high)
>>> p = randint.cdf(q, low, high)
>>> np.allclose(q, randint.ppf(p, low, high))
True

Generate random numbers:

>>> r = randint.rvs(low, high, size=1000)

c                    \        R R\        P                  ) \        P                  3R4      \        RR\        P                  ) \        P                  3R4      .# )lowThighr   r)   r,   s   &r.   r/   randint_gen._shape_info  sH    5$"&&"&&(9>J64266'266):NKM 	Mr2   c                J    W!8  \        V4      ,          \        V4      ,          # r4   r=   r-   r8  r9  s   &&&r.   r?   randint_gen._argcheck  s    
k#..T1BBBr2   c                    W^,
          3# rG   r   r<  s   &&&r.   rD   randint_gen._get_support  s    F{r2   c                    \         P                  ! V4      \         P                  ! V\         P                  R 7      V,
          ,          p\         P                  ! W8  W8  ,          VR4      # )r   r  )r*   	ones_liker  int64rD  )r-   rL   r8  r9  r$   s   &&&& r.   rT   randint_gen._pmf  sD    LLOrzz$bhh?#EFxxah/B77r2   c                P    \        V4      pWB,
          R ,           W2,
          ,          # r   r  )r-   rK   r8  r9  rL   s   &&&& r.   rY   randint_gen._cdf  s    !H",,r2   c                    \        WV,
          ,          V,           4      ^,
          pV^,
          P                  W#4      pV P                  WRV4      p\        P                  ! Wa8  WT4      # rG   )r   r  rY   r*   rD  )r-   rh   r8  r9  r   r  rY  s   &&&&   r.   ri   randint_gen._ppf  sR    A$s*+a/*yyT*xx	5//r2   c                    \         P                  ! V4      \         P                  ! V4      rCW4,           R ,
          ^,          pW4,
          pWf,          ^,
          R,          pRpRWf,          R ,           ,          Wf,          R ,
          ,          p	WWW3# )r   g      (@r  g333333)r*   r  )
r-   r8  r9  m2m1rr   drs   rt   ru   s
   &&&       r.   r{   randint_gen._stats  sk    D!2::c?Bgmq GsQw$s#qsSy1r2   Nc                   \         P                  ! V4      P                  ^8X  d3   \         P                  ! V4      P                  ^8X  d   \        WAW#R7      # Ve-   \         P                  ! W4      p\         P                  ! W#4      p\         P
                  ! \        \        V4      \         P                  ! \        4      .R7      pV! W4      # )z=An array of *size* random integers >= ``low`` and < ``high``.r@  )otypes)	r*   r  r7   r	   broadcast_to	vectorizer   r   r  )r-   r8  r9  r7   r8   randints   &&&&& r.   r9   randint_gen._rvs  s    ::c?1$D)9)>)>!)C4CC
 //#,C??4.D,,w|\B')xx}o7s!!r2   c                $    \        W!,
          4      # r4   )r   r<  s   &&&r.   r   randint_gen._entropy  s    4:r2   r   r   )r   r   r   r   r   r/   r?   rD   rT   rY   ri   r{   r9   r   r   r   r   s   @r.   r6  r6    s?     =~MC8
-0"" r2   r6  rR  z#A discrete uniform (random integer)c                   F   a  ] tR tRt o RtR tR
R ltR tR tR t	R	t
V tR# )zipf_geni  aA  A Zipf (Zeta) discrete random variable.

%(before_notes)s

See Also
--------
zipfian

Notes
-----
The probability mass function for `zipf` is:

.. math::

    f(k, a) = \frac{1}{\zeta(a) k^a}

for :math:`k \ge 1`, :math:`a > 1`.

`zipf` takes :math:`a > 1` as shape parameter. :math:`\zeta` is the
Riemann zeta function (`scipy.special.zeta`)

The Zipf distribution is also known as the zeta distribution, which is
a special case of the Zipfian distribution (`zipfian`).

%(after_notes)s

References
----------
.. [1] "Zeta Distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Zeta_distribution

%(example)s

Confirm that `zipf` is the large `n` limit of `zipfian`.

>>> import numpy as np
>>> from scipy.stats import zipf, zipfian
>>> k = np.arange(11)
>>> np.allclose(zipf.pmf(k, a), zipfian.pmf(k, a, n=10000000))
True

c                @    \        R R^\        P                  3R4      .# rC   Fr   r)   r,   s   &r.   r/   zipf_gen._shape_infoA      3266{NCDDr2   Nc                &    VP                  WR 7      # r?  )zipf)r-   rC   r7   r8   s   &&&&r.   r9   zipf_gen._rvsD  s       ..r2   c                    V^8  # rG   r   r-   rC   s   &&r.   r?   zipf_gen._argcheckG  s    1ur2   c                    VP                  \        P                  4      pR \        P                  ! V^4      ,          W) ,          ,          pV# r   )r   r*   float64r   zeta)r-   rL   rC   r  s   &&& r.   rT   zipf_gen._pmfJ  s7    HHRZZ 7<<1%%2-	r2   c                h    \         P                  ! W!^,           8  W!3R \        P                  R7      # )r'   c                 t    \         P                  ! W,
          ^4      \         P                  ! V ^4      ,          # rG   )r   rd  )rC   r#   s   &&r.   r   zipf_gen._munp.<locals>.<lambda>S  s!    aeQ/',,q!2DDr2   r$  r5  )r-   r#   rC   s   &&&r.   _munpzipf_gen._munpP  s*    AIvDvv 	r2   r   r   )r   r   r   r   r   r/   r9   r?   rT   ri  r   r   r   s   @r.   rW  rW    s*     )VE/ r2   rW  r]  zA Zipfc                   N   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
tV tR# )zipfian_geniZ  a  A Zipfian discrete random variable.

%(before_notes)s

See Also
--------
zipf

Notes
-----
The probability mass function for `zipfian` is:

.. math::

    f(k, a, n) = \frac{1}{H_{n,a} k^a}

for :math:`k \in \{1, 2, \dots, n-1, n\}`, :math:`a \ge 0`,
:math:`n \in \{1, 2, 3, \dots\}`.

`zipfian` takes :math:`a` and :math:`n` as shape parameters.
:math:`H_{n,a}` is the :math:`n`:sup:`th` generalized harmonic
number of order :math:`a`.

The SciPy implementation of this distribution requires :math:`1 \le n \le 2^{53}`.
For larger values of :math:`n`, the `zipfian` methods (`pmf`, `cdf`, `mean`, etc.)
will return `nan`.

When :math:`a > 1`, the Zipfian distribution reduces to the Zipf (zeta)
distribution as :math:`n \rightarrow \infty`.

%(after_notes)s

References
----------
.. [1] "Zipf's Law", Wikipedia, https://en.wikipedia.org/wiki/Zipf's_law
.. [2] Larry Leemis, "Zipf Distribution", Univariate Distribution
       Relationships. http://www.math.wm.edu/~leemis/chart/UDR/PDFs/Zipf.pdf

%(example)s

Confirm that `zipfian` reduces to `zipf` for large `n`, ``a > 1``.

>>> import numpy as np
>>> from scipy.stats import zipf, zipfian
>>> k = np.arange(11)
>>> np.allclose(zipfian.pmf(k, a=3.5, n=10000000), zipf.pmf(k, a=3.5))
True

c                z    \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      .# )rC   FTr#   r%   r   r)   r,   s   &r.   r/   zipfian_gen._shape_info  s:    3266{MB3q"&&k>BD 	Dr2   c           	         V^ 8  V\         P                  ! \         P                  ! V^R4      4      P                  \         P                  R7      8H  ,          # )r   rA  l          )r*   r  r  r   rC  r-   rC   r#   s   &&&r.   r?   zipfian_gen._argcheck  sG     abjjAu!56==BHH=MMO 	Pr2   c                2    ^\         P                  ! V4      3# rG   )r*   r   rp  s   &&&r.   rD   zipfian_gen._get_support  s    "((1+~r2   c                    \         P                  ! V4      p\         P                  ! V4      p\        P                  ! WW24      # r4   r*   r   rQ   _normalized_gen_harmonicr-   rL   rC   r#   s   &&&&r.   rT   zipfian_gen._pmf  s/    HHQKHHQK++A!77r2   c                    \         P                  ! V4      p\         P                  ! V4      p\        P                  ! ^WV4      # rG   ru  rw  s   &&&&r.   rY   zipfian_gen._cdf  s1    HHQKHHQK++AqQ77r2   c                    \         P                  ! V4      p\         P                  ! V4      p\        P                  ! V^,           W3V4      # rG   ru  rw  s   &&&&r.   r^   zipfian_gen._sf  s5    HHQKHHQK++AE1;;r2   c                d   \         P                  ! V4      p\        P                  ! W!4      p\        P                  ! W!^,
          4      p\        P                  ! W!^,
          4      p\        P                  ! W!^,
          4      p\        P                  ! W!^,
          4      pWC,          pWS,          V^,          ,
          p	V^,          p
W,          pWc,          ^V,          V,          V^,          ,          ,
          ^V^,          ,          V^,          ,          ,           VR,          ,          pV^,          V,          ^V^,          ,          V,          V,          ,
          ^V,          V^,          ,          V,          ,           ^V^,          ,          ,
          V	^,          ,          pV^,          pWW3# )r'   r  )r*   r   rQ   _gen_harmonic)r-   rC   r#   HnaHna1Hna2Hna3Hna4mu1mu2nmu2dmu2rt   ru   s   &&&           r.   r{   zipfian_gen._stats  s;   HHQK%  aC(  aC(  aC(  aC(h47"Avkh4S!V++aaiQ.>>c
J1fTkAc1fHTM$..3tQwt1CC$'	!1W%
ar2   r   N)r   r   r   r   r   r/   r?   rD   rT   rY   r^   r{   r   r   r   s   @r.   rl  rl  Z  s5     0dDP 8
8
<
   r2   rl  zipfianz	A Zipfianc                   R   a  ] tR tRt o RtR tR tR tR tR t	R t
RR
 ltRtV tR	# )dlaplace_geni  a   A  Laplacian discrete random variable.

%(before_notes)s

Notes
-----
The probability mass function for `dlaplace` is:

.. math::

    f(k) = \tanh(a/2) \exp(-a |k|)

for integers :math:`k` and :math:`a > 0`.

`dlaplace` takes :math:`a` as shape parameter.

%(after_notes)s

%(example)s

c                @    \        R R^ \        P                  3R4      .# rY  r)   r,   s   &r.   r/   dlaplace_gen._shape_info  r[  r2   c                h    \        VR ,          4      \        V) \        V4      ,          4      ,          # rm   )r   r   abs)r-   rL   rC   s   &&&r.   rT   dlaplace_gen._pmf  s$    AcE{S!c!f---r2   c                \    \        V4      pR  pR p\        P                  ! V^ 8  W23WE4      # )c                 d    R \        V) V ,          4      \        V4      ^,           ,          ,
          # r   r&  rL   rC   s   &&r.   r   dlaplace_gen._cdf.<locals>.f1  s$    aR!VA
333r2   c                 `    \        W^,           ,          4      \        V4      ^,           ,          # rG   r&  r  s   &&r.   f2dlaplace_gen._cdf.<locals>.f2  s     qE{#s1vz22r2   )r   r6  r7  )r-   rK   rC   rL   r   r  s   &&&   r.   rY   dlaplace_gen._cdf  s0    !H	4	3 qAvvr66r2   c           
     z   ^\        V4      ,           p\        \        P                  ! VR^\        V) 4      ,           ,          8  \	        W,          4      V,          ^,
          \	        ^V,
          V,          4      ) V,          4      4      pV^,
          p\        P                  ! V P                  WR4      V8  WT4      # )r'   r   )r   r   r*   rD  r   rY   )r-   rh   rC   constr   r  s   &&&   r.   ri   dlaplace_gen._ppf  s    CF
BHHQCG!44 \A-1!1Q3%-00146 7 qxx		%+q0%>>r2   c                
   \        V4      pR V,          VR,
          ^,          ,          pR V,          V^,          RV,          ,           R,           ,          VR,
          ^,          ,          pRVRWC^,          ,          R,
          3# )rm   r   g      $@r  r*  r&  )r-   rC   ear  r  s   &&   r.   r{   dlaplace_gen._stats  se    VeRUQJeRU3r6\"_%B
23CQJO++r2   c                f    V\        V4      ,          \        \        VR ,          4      4      ,
          # r  )r   r   r   r`  s   &&r.   r   dlaplace_gen._entropy   s"    47{Sae---r2   Nc                    \         P                  ! \         P                  ! V4      ) 4      ) pVP                  WBR 7      pVP                  WBR 7      pWV,
          # r?  )r*   r   r  rA  )r-   rC   r7   r8   probOfSuccessrK   ys   &&&&   r.   r9   dlaplace_gen._rvs  sL      2::a=.11""="<""="<ur2   r   r   )r   r   r   r   r   r/   rT   rY   ri   r{   r   r9   r   r   r   s   @r.   r  r    s3     ,E.	7?,. r2   r  dlaplacezA discrete Laplacianc                   `   a  ] tR tRt o RtR tR tRRRR/R ltR	 tR
 t	R t
R tR tRtV tR# )poisson_binom_geni  u  A Poisson Binomial discrete random variable.

%(before_notes)s

See Also
--------
binom

Notes
-----
The probability mass function for `poisson_binom` is:

.. math::

 f(k; p_1, p_2, ..., p_n) = \sum_{A \in F_k} \prod_{i \in A} p_i \prod_{j \in A^C} 1 - p_j

where :math:`k \in \{0, 1, \dots, n-1, n\}`, :math:`F_k` is the set of all
subsets of :math:`k` integers that can be selected :math:`\{0, 1, \dots, n-1, n\}`,
and :math:`A^C` is the complement of a set :math:`A`.

`poisson_binom` accepts a single array argument ``p`` for shape parameters
:math:`0 ≤ p_i ≤ 1`, where the last axis corresponds with the index :math:`i` and
any others are for batch dimensions. Broadcasting behaves according to the usual
rules except that the last axis of ``p`` is ignored. Instances of this class do
not support serialization/unserialization.

%(after_notes)s

References
----------
.. [1] "Poisson binomial distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Poisson_binomial_distribution
.. [2] Biscarri, William, Sihai Dave Zhao, and Robert J. Brunner. "A simple and
       fast method for computing the Poisson binomial distribution function".
       Computational Statistics & Data Analysis 122 (2018) 92-100.
       :doi:`10.1016/j.csda.2018.01.007`

%(example)s

c                    . # r4   r   r,   s   &r.   r/   poisson_binom_gen._shape_infoF  s	     	r2   c                    \         P                  ! V^ R7      p^ V8*  V^8*  ,          p\         P                  ! V^ R7      # r~   )r*   stackall)r-   argsr$   condss   &*  r.   r?   poisson_binom_gen._argcheckK  s5    HHT"aAF#vve!$$r2   r7   Nr8   c               F   \         P                  ! VRR7      pVf   VP                  M1\         P                  ! V4      '       d   V^3M\	        V4      R,           p\         P
                  ! VP                  V4      p\        P                  WAVR7      P                  RR7      # )r'   r   r   rG   )	r*   r  shapeisscalartuplebroadcast_shapesr   r9   r   )r-   r7   r8   r  r$   s   &$$* r.   r9   poisson_binom_gen._rvsP  s|    HHT#  <[[..q	E$K$4F 	""177D1~~a~FJJPRJSSr2   c                    ^ \        V4      3# r<   )len)r-   r  s   &*r.   rD   poisson_binom_gen._get_supportZ  s    #d)|r2   c                    \         P                  ! V4      P                  \         P                  4      p\         P                  ! V.VO5!  vr\         P
                  ! V\         P                  R 7      p\        WR4      # )rA  r  r*   
atleast_1dr   rC  r   r  rc  r   r-   rL   r  s   &&*r.   rT   poisson_binom_gen._pmf]  W    MM!##BHH-&&q040zz$bjj1au--r2   c                    \         P                  ! V4      P                  \         P                  4      p\         P                  ! V.VO5!  vr\         P
                  ! V\         P                  R 7      p\        WR4      # )rA  r   r  r  s   &&*r.   rY   poisson_binom_gen._cdfc  r  r2   c                    \         P                  ! V^ R7      p\         P                  ! V^ R7      p\         P                  ! V^V,
          ,          ^ R7      pWERR3# )r   r   N)r*   r  r   )r-   r  kwdsr$   r"  rs   s   &*,   r.   r{   poisson_binom_gen._statsi  sG    HHT"vvaa ffQ!A#YQ'4&&r2   c                     \        V .VO5/ VB # r4   )poisson_binomial_frozen)r-   r  r  s   &*,r.   __call__poisson_binom_gen.__call__o  s    &t;d;d;;r2   r   )r   r   r   r   r   r/   r?   r9   rD   rT   rY   r{   r  r   r   r   s   @r.   r  r    sI     'P
%
Tt T$ T..'< <r2   r  poisson_binomzA Poisson binomialr$   )r   rc  shapesc                 L    \        \        P                  ! VR^ 4      4      VRV3# r'   r   r  r  r*   moveaxis)r-   r$   locr7   s   &&&&r.   _parse_args_rvsr  {  s#    QA&'c477r2   c                 L    \        \        P                  ! VR^ 4      4      VRV3# r  r  )r-   r$   r  rq   s   &&&&r.   _parse_args_statsr  ~  s#    QA&'c7::r2   c                 J    \        \        P                  ! VR^ 4      4      VR3# r  r  )r-   r$   r  s   &&&r.   _parse_argsr    s!    QA&'c11r2   c                   0   a  ] tR tRt o R tRR ltRtV tR# )r  i  c                   W n         W0n        VP                  ! R/ VP                  4       B V n        \
        P                  \        \        4      V P                  n        \        P                  \        \        4      V P                  n	        \        P                  \        \        4      V P                  n
        V P                  P                  ! V/ VB w  p pV P                  P                  ! V!  w  V n        V n        R # )Nr   )r  r  	__class___updated_ctor_paramdistr  __get___pb_obj_pb_clsr  r  rD   rC   r   )r-   r  r  r  r  _s   &&*,  r.   __init__ poisson_binomial_frozen.__init__  s    		 NN@T%=%=%?@	 %4$;$;GW$M		!&7&?&?&Q		# + 3 3GW E		yy,,d;d;1//8r2   Nc                    V P                   P                  ! V P                  / V P                  B w  rgpV P                   P                  ! WP                  WrW43/ VB # r4   )r  r  r  r  expect)	r-   funclbubconditionalr  rC   r  scales	   &&&&&,   r.   r  poisson_binomial_frozen.expect  sK    		--tyyFDIIF yyii"RTRRr2   )rC   r  r   r  r  )NNNF)r   r   r   r   r  r  r   r   r   s   @r.   r  r    s     9S Sr2   r  c                   F   a  ] tR tRt o RtR tR
R ltR tR tR t	R	t
V tR# )skellam_geni  a  A  Skellam discrete random variable.

%(before_notes)s

Notes
-----
Probability distribution of the difference of two correlated or
uncorrelated Poisson random variables.

Let :math:`k_1` and :math:`k_2` be two Poisson-distributed r.v. with
expected values :math:`\lambda_1` and :math:`\lambda_2`. Then,
:math:`k_1 - k_2` follows a Skellam distribution with parameters
:math:`\mu_1 = \lambda_1 - \rho \sqrt{\lambda_1 \lambda_2}` and
:math:`\mu_2 = \lambda_2 - \rho \sqrt{\lambda_1 \lambda_2}`, where
:math:`\rho` is the correlation coefficient between :math:`k_1` and
:math:`k_2`. If the two Poisson-distributed r.v. are independent then
:math:`\rho = 0`.

Parameters :math:`\mu_1` and :math:`\mu_2` must be strictly positive.

For details see: https://en.wikipedia.org/wiki/Skellam_distribution

`skellam` takes :math:`\mu_1` and :math:`\mu_2` as shape parameters.

%(after_notes)s

%(example)s

c                z    \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      .# )r  Fr  r   r)   r,   s   &r.   r/   skellam_gen._shape_info  s:    5%!RVVnE5%!RVVnEG 	Gr2   Nc                T    TpVP                  W4      VP                  W%4      ,
          # r4   r  )r-   r  r  r7   r8   r#   s   &&&&& r.   r9   skellam_gen._rvs  s-    $$S,$$S,- 	.r2   c                   \         P                  ! R R7      ;_uu_ 4        \         P                  ! V^ 8  \        P                  ! ^V,          ^^V,
          ,          ^V,          4      ^,          \        P                  ! ^V,          ^^V,           ,          ^V,          4      ^,          4      pRRR4       V#   + '       g   i     X# ; ir  )r*   r   rD  rQ   	_ncx2_pdfr-   rK   r  r  pxs   &&&& r.   rT   skellam_gen._pmf  s    [[h''!a%--#q!A#w#>q@--#q!A#w#>q@BB (
 	 ('
 	s   BB88C		c                   \        V4      p\        P                  ! R R7      ;_uu_ 4        \        P                  ! V^ 8  \        P
                  ! ^V,          RV,          ^V,          4      \        P                  ! ^V,          ^V^,           ,          ^V,          4      4      pRRR4       V#   + '       g   i     X# ; i)r   r  N)r   r*   r   rD  r   chndtrrQ   _ncx2_sfr  s   &&&& r.   rY   skellam_gen._cdf  s    !H[[h''!a%!..31ae<,,qua1gqu=?B ( 		 (' 	s   A9B..B?	c                n    W,
          pW,           pV\        V^,          4      ,          p^V,          pW4WV3# )   r+  )r-   r  r  r"  rs   rt   ru   s   &&&    r.   r{   skellam_gen._stats  s6    yiD#N"W"  r2   r   r   )r   r   r   r   r   r/   r9   rT   rY   r{   r   r   r   s   @r.   r  r    s)     :G.
! !r2   r  skellamz	A Skellamc                   ^   a  ] tR tRt o RtR tRR ltR tR tR t	R	 t
R
 tR tR tRtV tR# )yulesimon_geni  a  A Yule-Simon discrete random variable.

%(before_notes)s

Notes
-----

The probability mass function for the `yulesimon` is:

.. math::

    f(k) =  \alpha B(k, \alpha+1)

for :math:`k=1,2,3,...`, where :math:`\alpha>0`.
Here :math:`B` refers to the `scipy.special.beta` function.

The sampling of random variates is based on pg 553, Section 6.3 of [1]_.
Our notation maps to the referenced logic via :math:`\alpha=a-1`.

For details see the wikipedia entry [2]_.

References
----------
.. [1] Devroye, Luc. "Non-uniform Random Variate Generation",
     (1986) Springer, New York.

.. [2] https://en.wikipedia.org/wiki/Yule-Simon_distribution

%(after_notes)s

%(example)s

c                @    \        R R^ \        P                  3R4      .# )alphaFr   r)   r,   s   &r.   r/   yulesimon_gen._shape_info  s    7EArvv;GHHr2   Nc           	         VP                  V4      pVP                  V4      p\        V) \        \        V) V,          4      ) 4      ,          4      pV# r4   )standard_exponentialr   r   r   )r-   r   r7   r8   E1E2anss   &&&&   r.   r9   yulesimon_gen._rvs
  sK    ..t4..t4B3RC%K 00112
r2   c                J    V\         P                  ! W^,           4      ,          # rG   r   r   r-   rK   r   s   &&&r.   rT   yulesimon_gen._pmf  s    w||Aqy111r2   c                    V^ 8  # r<   r   )r-   r   s   &&r.   r?   yulesimon_gen._argcheck  s    	r2   c                \    \        V4      \        P                  ! W^,           4      ,           # rG   r   r   r   r
  s   &&&r.   rN   yulesimon_gen._logpmf  s    5zGNN1ai888r2   c                X    ^V\         P                  ! W^,           4      ,          ,
          # rG   r	  r
  s   &&&r.   rY   yulesimon_gen._cdf  s    1w||Aqy1111r2   c                J    V\         P                  ! W^,           4      ,          # rG   r	  r
  s   &&&r.   r^   yulesimon_gen._sf  s    7<<19---r2   c                \    \        V4      \        P                  ! W^,           4      ,           # rG   r  r
  s   &&&r.   rT  yulesimon_gen._logsf  s    1vq!)444r2   c                   \         P                  ! V^8*  \         P                  W^,
          ,          4      p\         P                  ! V^8  V^,          VR,
          V^,
          ^,          ,          ,          \         P                  4      p\         P                  ! V^8*  \         P                  V4      p\         P                  ! V^8  \	        V^,
          4      V^,           ^,          ,          W^,
          ,          ,          \         P                  4      p\         P                  ! V^8*  \         P                  V4      p\         P                  ! V^8  V^,           ^V^,          ,          ^1V,          ,
          ^,
          W^,
          ,          V^,
          ,          ,          ,           \         P                  4      p\         P                  ! V^8*  \         P                  V4      pW#WE3# r  )r*   rD  r+   nanr   )r-   r   rr   r  rt   ru   s   &&    r.   r{   yulesimon_gen._stats"  sQ   XXeqj"&&%19*=>hhuqyaxECKEAI>#ABvv hhuz2663/XXeai519oQ6%19:MNff XXeqj"&&"-XXeaiaiBMBJ$>$C$)QY$7519$E$G Hff XXeqj"&&"-r2   r   r   )r   r   r   r   r   r/   r9   rT   r?   rN   rY   r^   rT  r{   r   r   r   s   @r.   r  r    s>      BI292.5 r2   r  	yulesimon)r   rC   c                   X   a  ] tR tRt o RtRtRtR tR tR t	RR lt
R tRR	 ltR
tV tR# )_nchypergeom_geni7  zA noncentral hypergeometric discrete random variable.

For subclassing by nchypergeom_fisher_gen and nchypergeom_wallenius_gen.

Nc           	         \        R R^ \        P                  3R4      \        RR^ \        P                  3R4      \        RR^ \        P                  3R4      \        RR^ \        P                  3R4      .# )rg  TFr#   rh  oddsr%   r   r)   r,   s   &r.   r/   _nchypergeom_gen._shape_infoA  sf    3q"&&k=A3q"&&k=A3q"&&k=A651bff+~FH 	Hr2   c                    YTr%pW5,
          p\         P                  ! ^ W&,
          4      p\         P                  ! W%4      pWx3# r<   ro  )	r-   rg  r#   rh  r  rK  rJ  x_minx_maxs	   &&&&&    r.   rD   _nchypergeom_gen._get_supportG  s:    qV

1af%

1!|r2   c                   \         P                  ! V4      \         P                  ! V4      r!\         P                  ! V4      \         P                  ! V4      rC\         P                  ! V4      ( VP                  \        4      V8H  ,          V^ 8  ,          p\         P                  ! V4      ( VP                  \        4      V8H  ,          V^ 8  ,          p\         P                  ! V4      ( VP                  \        4      V8H  ,          V^ 8  ,          pV^ 8  pW18*  p	W!8*  p
WV,          V,          V,          V	,          V
,          # r<   )r*   r  isnanr   r  )r-   rg  r#   rh  r  cond1cond2cond3cond4cond5cond6s   &&&&&      r.   r?   _nchypergeom_gen._argcheckN  s    zz!}bjjm1**Q-D!14((1+!((3-1"45a@((1+!((3-1"45a@((1+!((3-1"45a@q}u$u,u4u<<r2   c           	     8   a  \         V 3R  l4       pV! WW4WVR7      # )c                   < \         P                  ! V 4      \         P                  ! V4      ,          \         P                  ! V4      ,          '       d&   \         P                  ! V\         P                  4      # \         P                  ! V4      p\        4       p\        VS
P                  4      pV! W!WWe4      p	V	P                  V4      p	V	# r4   )	r*   r%  fullr  prodr   getattrrvs_namereshape)rg  r#   rh  r  r7   r8   lengthurnrv_genr  r-   s   &&&&&&    r.   r  $_nchypergeom_gen._rvs.<locals>._rvs1[  s    xx{RXXa[(288A;66wwtRVV,,WWT]F#%CS$--0Fq=C++d#CJr2   r   r  )r-   rg  r#   rh  r  r7   r8   r  s   f&&&&&& r.   r9   _nchypergeom_gen._rvsY  s&    	#	 
$	 Q1IIr2   c                   a  \         P                  ! WW4V4      w  rr4pVP                  ^ 8X  d   \         P                  ! V4      # \         P                  V 3R l4       pV! WW4V4      # )r   c                 F  < \         P                  ! V 4      \         P                  ! V4      ,          \         P                  ! V4      ,          \         P                  ! V4      ,          '       d   \         P                  # SP                  W2WR 4      pVP	                  V 4      # g-q=)r*   r%  r  r  probability)rK   rg  r#   rh  r  r5  r-   s   &&&&& r.   _pmf1$_nchypergeom_gen._pmf.<locals>._pmf1n  sb    xx{RXXa[(288A;6!DDvv))A!51C??1%%r2   )r*   r   r7   
empty_likerQ  )r-   rK   rg  r#   rh  r  r=  s   f&&&&& r.   rT   _nchypergeom_gen._pmfh  s_    ..qQ4@aD66Q;==##		& 
	& Q1&&r2   c                z   a  \         P                  V 3R  l4       pRV9   g   RV9   d
   V! WW44      MRw  rxRRrWxW3# )c                 .  < \         P                  ! V 4      \         P                  ! V4      ,          \         P                  ! V4      ,          '       d!   \         P                  \         P                  3# SP                  W!WR 4      pVP	                  4       # r;  )r*   r%  r  r  rq   )rg  r#   rh  r  r5  r-   s   &&&& r.   	_moments1*_nchypergeom_gen._stats.<locals>._moments1y  s[    xx{RXXa[(288A;66vvrvv~%))A!51C;;= r2   r  vNr   )r*   rQ  )r-   rg  r#   rh  r  rq   rC  r  rE  rl   rL   s   f&&&&&     r.   r{   _nchypergeom_gen._statsw  sL    		! 
	! .1G^sg~	!(! 	T1Qzr2   r   r   r   )r   r   r   r   r   r2  r  r/   rD   r?   r9   rT   r{   r   r   r   s   @r.   r  r  7  s;      HDH	=J' r2   r  c                   "    ] tR tRtRtRt]tRtR# )nchypergeom_fisher_geni  a  A Fisher's noncentral hypergeometric discrete random variable.

Fisher's noncentral hypergeometric distribution models drawing objects of
two types from a bin. `M` is the total number of objects, `n` is the
number of Type I objects, and `odds` is the odds ratio: the odds of
selecting a Type I object rather than a Type II object when there is only
one object of each type.
The random variate represents the number of Type I objects drawn if we
take a handful of objects from the bin at once and find out afterwards
that we took `N` objects.

%(before_notes)s

See Also
--------
nchypergeom_wallenius, hypergeom, nhypergeom

Notes
-----
Let mathematical symbols :math:`N`, :math:`n`, and :math:`M` correspond
with parameters `N`, `n`, and `M` (respectively) as defined above.

The probability mass function is defined as

.. math::

    p(x; M, n, N, \omega) =
    \frac{\binom{n}{x}\binom{M - n}{N-x}\omega^x}{P_0},

for
:math:`x \in [x_l, x_u]`,
:math:`M \in {\mathbb N}`,
:math:`n \in [0, M]`,
:math:`N \in [0, M]`,
:math:`\omega > 0`,
where
:math:`x_l = \max(0, N - (M - n))`,
:math:`x_u = \min(N, n)`,

.. math::

    P_0 = \sum_{y=x_l}^{x_u} \binom{n}{y}\binom{M - n}{N-y}\omega^y,

and the binomial coefficients are defined as

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

`nchypergeom_fisher` uses the BiasedUrn package by Agner Fog with
permission for it to be distributed under SciPy's license.

The symbols used to denote the shape parameters (`N`, `n`, and `M`) are not
universally accepted; they are chosen for consistency with `hypergeom`.

Note that Fisher's noncentral hypergeometric distribution is distinct
from Wallenius' noncentral hypergeometric distribution, which models
drawing a pre-determined `N` objects from a bin one by one.
When the odds ratio is unity, however, both distributions reduce to the
ordinary hypergeometric distribution.

%(after_notes)s

References
----------
.. [1] Agner Fog, "Biased Urn Theory".
       https://cran.r-project.org/web/packages/BiasedUrn/vignettes/UrnTheory.pdf

.. [2] "Fisher's noncentral hypergeometric distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Fisher's_noncentral_hypergeometric_distribution

%(example)s


rvs_fisherr   N)	r   r   r   r   r   r2  r   r  r   r   r2   r.   rH  rH    s    GR H%Dr2   rH  nchypergeom_fisherz$A Fisher's noncentral hypergeometricc                   "    ] tR tRtRtRt]tRtR# )nchypergeom_wallenius_geni  a  A Wallenius' noncentral hypergeometric discrete random variable.

Wallenius' noncentral hypergeometric distribution models drawing objects of
two types from a bin. `M` is the total number of objects, `n` is the
number of Type I objects, and `odds` is the odds ratio: the odds of
selecting a Type I object rather than a Type II object when there is only
one object of each type.
The random variate represents the number of Type I objects drawn if we
draw a pre-determined `N` objects from a bin one by one.

%(before_notes)s

See Also
--------
nchypergeom_fisher, hypergeom, nhypergeom

Notes
-----
Let mathematical symbols :math:`N`, :math:`n`, and :math:`M` correspond
with parameters `N`, `n`, and `M` (respectively) as defined above.

The probability mass function is defined as

.. math::

    p(x; N, n, M) = \binom{n}{x} \binom{M - n}{N-x}
    \int_0^1 \left(1-t^{\omega/D}\right)^x\left(1-t^{1/D}\right)^{N-x} dt

for
:math:`x \in [x_l, x_u]`,
:math:`M \in {\mathbb N}`,
:math:`n \in [0, M]`,
:math:`N \in [0, M]`,
:math:`\omega > 0`,
where
:math:`x_l = \max(0, N - (M - n))`,
:math:`x_u = \min(N, n)`,

.. math::

    D = \omega(n - x) + ((M - n)-(N-x)),

and the binomial coefficients are defined as

.. math:: \binom{n}{k} \equiv \frac{n!}{k! (n - k)!}.

`nchypergeom_wallenius` uses the BiasedUrn package by Agner Fog with
permission for it to be distributed under SciPy's license.

The symbols used to denote the shape parameters (`N`, `n`, and `M`) are not
universally accepted; they are chosen for consistency with `hypergeom`.

Note that Wallenius' noncentral hypergeometric distribution is distinct
from Fisher's noncentral hypergeometric distribution, which models
take a handful of objects from the bin at once, finding out afterwards
that `N` objects were taken.
When the odds ratio is unity, however, both distributions reduce to the
ordinary hypergeometric distribution.

%(after_notes)s

References
----------
.. [1] Agner Fog, "Biased Urn Theory".
       https://cran.r-project.org/web/packages/BiasedUrn/vignettes/UrnTheory.pdf

.. [2] "Wallenius' noncentral hypergeometric distribution", Wikipedia,
       https://en.wikipedia.org/wiki/Wallenius'_noncentral_hypergeometric_distribution

%(example)s

rvs_walleniusr   N)	r   r   r   r   r   r2  r   r  r   r   r2   r.   rL  rL    s    GR H'Dr2   rL  nchypergeom_walleniusz&A Wallenius' noncentral hypergeometric)r   N)r   r   r<   )i	functoolsr   scipyr   scipy.specialr   r   r   r   rH   scipy.special._ufuncs_ufuncsrQ   scipy._lib._utilr	   scipy._lib.array_api_extra_libarray_api_extrar6  scipy.interpolater
   numpyr   r   r   r   r   r   r   r   r   r   r*   _distn_infrastructurer   r   r   r   r   r   
_biasedurnr   r   r   _stats_pythranr   r    r   r   r   r   r   r   r  r  r9  r;  rb  re  r  r  r  r  r  r  r  r  r  r  r4  r6  rR  rW  r]  rl  r  r  r+   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rH  rJ  rL  rN  listglobalscopyitemspairs_distn_names_distn_gen_names__all__r   r2   r.   <module>re     s  
   C C # # ) ( ( & M M M 8 8, , +]* ]*@ 	w>#I >#B AK0	OK Od {+	r
 r
j 
	"Z[ Zz .
N7{ N7b !&=9XK Xv {+	[[ [| .
= =@ 
ah	A?+ ?D 9{
;D0 D0N 
ah1J	K<K <~ {a#FH	t+ tn 9 0) *
?{ ?D !&84i + i X 	K
@M; M` 266''2HJS< S<l "AU),.8;2
 !"3  / 7 7 I "3";";GW"M '//A S0 S0<!+ <!~ i+
FLK L^ {a0	L{ L^K&- K&\ ,	35 
K( 0 K(\ 2	 57  	WY^^##%&!7{!K 
)
)r2   