Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « scipy.special »

Fonction betainc - module scipy.special

Signature de la fonction betainc

Description

betainc.__doc__

betainc(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])

betainc(a, b, x, out=None)

Incomplete beta function.

Computes the incomplete beta function, defined as [1]_:

.. math::

    I_x(a, b) = \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} \int_0^x
    t^{a-1}(1-t)^{b-1}dt,

for :math:`0 \leq x \leq 1`.

Parameters
----------
a, b : array-like
       Positive, real-valued parameters
x : array-like
    Real-valued such that :math:`0 \leq x \leq 1`,
    the upper limit of integration
out : ndarray, optional
    Optional output array for the function values

Returns
-------
array-like
    Value of the incomplete beta function

See Also
--------
beta : beta function
betaincinv : inverse of the incomplete beta function

Notes
-----
The incomplete beta function is also sometimes defined
without the `gamma` terms, in which case the above
definition is the so-called regularized incomplete beta
function. Under this definition, you can get the incomplete
beta function by multiplying the result of the SciPy
function by `beta`.

References
----------
.. [1] NIST Digital Library of Mathematical Functions
       https://dlmf.nist.gov/8.17

Examples
--------

Let :math:`B(a, b)` be the `beta` function.

>>> import scipy.special as sc

The coefficient in terms of `gamma` is equal to
:math:`1/B(a, b)`. Also, when :math:`x=1`
the integral is equal to :math:`B(a, b)`.
Therefore, :math:`I_{x=1}(a, b) = 1` for any :math:`a, b`.

>>> sc.betainc(0.2, 3.5, 1.0)
1.0

It satisfies
:math:`I_x(a, b) = x^a F(a, 1-b, a+1, x)/ (aB(a, b))`,
where :math:`F` is the hypergeometric function `hyp2f1`:

>>> a, b, x = 1.4, 3.1, 0.5
>>> x**a * sc.hyp2f1(a, 1 - b, a + 1, x)/(a * sc.beta(a, b))
0.8148904036225295
>>> sc.betainc(a, b, x)
0.8148904036225296

This functions satisfies the relationship
:math:`I_x(a, b) = 1 - I_{1-x}(b, a)`:

>>> sc.betainc(2.2, 3.1, 0.4)
0.49339638807619446
>>> 1 - sc.betainc(3.1, 2.2, 1 - 0.4)
0.49339638807619446