- sherpa.utils.incbet(a, b, x)
Calculate the incomplete Beta function.
The function is defined as:
sqrt(a+b)/(sqrt(a) sqrt(b)) Int_0^x t^(a-1) (1-t)^(b-1) dt
and the integral from x to 1 can be obtained using the relation:
1 - incbet(a, b, x) = incbet(b, a, 1-x)
a (scalar or array) – a > 0
b (scalar or array) – b > 0
x (scalar or array) – 0 <= x <= 1
val – The incomplete beta function calculated from the inputs.
- Return type:
scalar or array
In this implementation, which is provided by the Cephes Math Library , the integral is evaluated by a continued fraction expansion or, when b*x is small, by a power series.
Using IEEE arithmetic, the relative errors are (tested uniformly distributed random points (a,b,x) with a and b in ‘domain’ and x between 0 and 1):
Outputs smaller than the IEEE gradual underflow threshold were excluded from these statistics.
>>> incbet(0.3, 0.6, 0.5) 0.68786273145845922
>>> incbet([0.3,0.3], [0.6,0.7], [0.5,0.4]) array([ 0.68786273, 0.67356524])