Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2010

Jump to: Description · Examples · Bugs · See Also

AHELP for CIAO 4.3 Sherpa v1


Context: utilities


Calculate the incomplete Beta function




Calculate the CEPHES function, incbet, in the range [a > 0; b > 0; 0 <= x <= 1] . The function returns incomplete beta integral of the arguments (scalar or array based), evaluated from zero to x.

The function is defined as

sqrt(a+b)/[sqrt(a)sqrt(b)] Int_(0)^(x) t^(a-1) (1-t)^(b-1) dt

The domain of definition is 0 <= x <= 1. In this implementation a and b are restricted to positive values. The integral from x to 1 may be obtained by the symmetry relation

    1 - incbet( a, b, x )  =  incbet( b, a, 1-x ).

The integral is evaluated by a continued fraction expansion or, when b*x is small, by a power series.


Tested at uniformly distributed random points (a,b,x) with a and b in "domain" and x between 0 and 1.

Relative error

arithmetic domain # trials peak rms
IEEE 0,5 10000 6.9e-15 4.5e-16
IEEE 0,85 250000 2.2e-13 1.7e-14
IEEE 0,1000 30000 5.3e-12 6.3e-13
IEEE 0,10000 250000 9.3e-11 7.1e-12
IEEE 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.

Example 1

sherpa> incbet(0.3,0.6,0.5)

Calculate incbet with a=0.3, b=0.6, x=0.5 .

Example 2

sherpa> incbet([0.3],[0.6],[0.5])

Calculate incbet with a=[0.3], b=[0.6], x=[0.5] .


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

See Also

calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, gamma, igam, igamc, lgam

Last modified: December 2010
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2019. All rights reserved.