AHELP for CIAO 4.14 Sherpa

# incbet

Context: utilities

## Synopsis

Calculate the incomplete Beta function.

## Syntax

```incbet(a, b, x)

a - scalar or array
b - scalar or array
x - scalar or array```

## 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 Definition
a a > 0
b b > 0
x 0 <= x <= 1

### Return value

The return value from this function is:

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

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):

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.

•  Cephes Math Library Release 2.0: April, 1987. Copyright 1985, 1987 by Stephen L. Moshier. Direct inquiries to 30 Frost Street, Cambridge, MA 02140.

## Bugs

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