Last modified: December 2024

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/incbet.html
AHELP for CIAO 4.17 Sherpa

incbet

Context: utilities

Synopsis

Calculate the incomplete Beta function.

Syntax

incbet(a, b, x)

Description

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)

Examples

Example 1

>>> incbet(0.3, 0.6, 0.5)
0.68786273145845922

Example 2

>>> incbet([0.3,0.3], [0.6,0.7], [0.5,0.4])
array([ 0.68786273,  0.67356524])

PARAMETERS

The parameters for this function are:

Parameter Type information Definition
a scalar or array a > 0
b scalar or array b > 0
x scalar or array 0 <= x <= 1

Return value

The return value from this function is:

val -- The incomplete beta function calculated from the inputs.

Notes

In this implementation, which is provided by the Cephes Math Library [1] , 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):

domain # trials peak rms
0,5 10000 6.9e-15 4.5e-16
0,85 250000 2.2e-13 1.7e-14
0,1000 30000 5.3e-12 6.3e-13
0,1000 250000 9.3e-11 7.1e-12
0,100000 10000 8.7e-10 4.8e-11

Outputs smaller than the IEEE gradual underflow threshold were excluded from these statistics.

References


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

tools::response
color_color, modelflux
tools::statistics
aprates
utilities
calc_chisqr, calc_energy_flux, calc_ftest, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, gamma, igam, igamc, lgam