Skip to content

BetaRegularized ​

The regularized incomplete beta function Ix(a,b)I_x(a, b), the CDF of the Beta(a, b) distribution and a bridge to the binomial CDF.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageBetaRegularized!
BetaRegularized(x, a, b)the regularized incomplete beta function Ix(a,b)I_x(a, b).
SymPybetainc_regularized(a, b, 0, x)Juliaenumeratio_ball((z, a, b) -> _betainc(z, a, b) / _beta(a, b), x, a, b)Rustbeta_regularized(a, b, x)
Typed signatures
TypePackageApplies
(complex | infinity, complex | infinity, complex | infinity) -> numbercompute-enginealways
(number, number, number, number?) -> numberanalyticreplaces compute-enginealways

Domain: Special functions

Details
  • Normalized against Beta: Ix(a,b)I_x(a, b) is the incomplete beta integral at x, divided by B(a,b)B(a, b), so I0(a,b)=0I_0(a,b)=0 and I1(a,b)=1I_1(a,b)=1.
  • Symmetry: Ix(a,b)+I1−x(b,a)=1I_x(a, b) + I_{1-x}(b, a) = 1.
  • Ties to the binomial CDF: for X∼Binomial(n,p)X \sim \text{Binomial}(n, p), P(X≤k)=I1−p(n−k,k+1)P(X \leq k) = I_{1-p}(n-k, k+1).
  • By symmetry, I1/2(a,a)=1/2I_{1/2}(a, a) = 1/2 for any a: a symmetric Beta(a, a) distribution has its median exactly at the midpoint.
  • Outside [0,1][0, 1] the function continues analytically. At integers a,b≥1a, b \ge 1 it is a polynomial in x, the binomial tail ∑j=an(nj)xj(1−x)n−j\sum_{j=a}^{n}\binom{n}{j}x^j(1-x)^{n-j} with n=a+b−1n = a+b-1, so a rational x has an exact value (I2(2,3)=8I_2(2, 3) = 8, I−1(2,3)=17I_{-1}(2, 3) = 17) and a float x the value at that double. A real a>0a > 0 with integer b past x=1x = 1 is summed in doubles. Anything else outside [0,1][0, 1] (a non-integer b, where the value is complex) stays unevaluated.

Plot

Examples

1 more kept as data, checked against the oracles
Basic #
live ↗
InBetaRegularized⁡(0,2,3)\operatorname{BetaRegularized}(0, 2, 3)Out00
live ↗
InBetaRegularized⁡(1,2,3)\operatorname{BetaRegularized}(1, 2, 3)Out11

A floating-point x evaluates directly to a decimal

live ↗
InBetaRegularized⁡(0.5,2,3)\operatorname{BetaRegularized}(0.5, 2, 3)Out0.687 50.687\,5

Ix(1,1)=xI_x(1, 1) = x, the uniform distribution's own CDF

live ↗
InBetaRegularized⁡(0.5,1,1)\operatorname{BetaRegularized}(0.5, 1, 1)Out0.50.5

Non-integer parameters

live ↗
InBetaRegularized⁡(0.4,2.5,3.5)\operatorname{BetaRegularized}(0.4, 2.5, 3.5)Out0.486 904 191 526 117 355 2540.486\,904\,191\,526\,117\,355\,254

I1/2(2,3)=11/16I_{1/2}(2, 3) = 11/16 exactly

live ↗
InBetaRegularized⁡(12,2,3)\operatorname{BetaRegularized}(\frac{1}{2}, 2, 3)Out1116\frac{11}{16}
Scope #

Threads element-wise over a list, as Wolfram's Listable heads do

live ↗
InBetaRegularized⁡(0.5,[1,2],1)\operatorname{BetaRegularized}(0.5, \bigl\lbrack1, 2\bigr\rbrack, 1)Out[0.5,0.25]\bigl\lbrack0.5, 0.25\bigr\rbrack

xx outside [0,1][0, 1] by continuation: real here, as b=5b = 5 makes the integrand a polynomial times t−1/2t^{-1/2}

live ↗
InBetaRegularized⁡(2,0.5,5)\operatorname{BetaRegularized}(2, 0.5, 5)Out1.182 194 149 796 259 11.182\,194\,149\,796\,259\,1

Four arguments: the generalized Iz1(a,b)−Iz0(a,b)I_{z_1}(a, b) - I_{z_0}(a, b)

live ↗
InBetaRegularized⁡(0.2,0.5,2,3)\operatorname{BetaRegularized}(0.2, 0.5, 2, 3)Out0.506 70.506\,7

Interval arithmetic: Ix(2,1)=x2I_x(2, 1) = x^2

live ↗
InBetaRegularized⁡(Interval(0.2,0.3),2,1)\operatorname{BetaRegularized}(\mathrm{Interval}(0.2, 0.3), 2, 1)OutInterval(0.04,0.09)\mathrm{Interval}(0.04, 0.09)

Uncertainty propagation

live ↗
InBetaRegularized⁡(Around(0.3,0.01),1,2)\operatorname{BetaRegularized}(\mathrm{Around}(0.3, 0.01), 1, 2)OutAround(0.51,0.014)\mathrm{Around}(0.51, 0.014)

To 30 significant digits, every one correctly rounded

live ↗
InN(BetaRegularized⁡(13,2,3),30)N(\operatorname{BetaRegularized}(\frac{1}{3}, 2, 3), 30)Out0.407 407 407 407 407 407 407 407 407 4070.407\,407\,407\,407\,407\,407\,407\,407\,407\,407
Applications #

Binomial CDF via the regularized beta: for X∼Binomial(4,0.3)X \sim \text{Binomial}(4, 0.3), P(X≤1)=I0.7(3,2)P(X \leq 1) = I_{0.7}(3, 2)

live ↗
InBetaRegularized⁡(0.7,3,2)=0.74+4×0.3×0.73\operatorname{BetaRegularized}(0.7, 3, 2)=0.7^4+4×0.3×0.7^3OutTrue\mathrm{True}
Properties #

Symmetry: Ix(a,b)+I1−x(b,a)=1I_x(a, b) + I_{1-x}(b, a) = 1

live ↗
InBetaRegularized⁡(0.3,2,3)+BetaRegularized⁡(0.7,3,2)=1\operatorname{BetaRegularized}(0.3, 2, 3)+\operatorname{BetaRegularized}(0.7, 3, 2)=1OutTrue\mathrm{True}

I1/2(a,a)=1/2I_{1/2}(a, a) = 1/2 for any a, here at a=10a = 10

live ↗
InBetaRegularized⁡(0.5,10,10)\operatorname{BetaRegularized}(0.5, 10, 10)Out0.50.5

Ix(a,1)=xaI_x(a, 1) = x^a, here 0.2111…50.2111\ldots^5

live ↗
InBetaRegularized⁡(0.211 111 111 111 111 1,5,1)\operatorname{BetaRegularized}(0.211\,111\,111\,111\,111\,1, 5, 1)Out0.000 419 329 539 873 664 134 5990.000\,419\,329\,539\,873\,664\,134\,599

The arcsine distribution's median: I1/2(1/2,1/2)=1/2I_{1/2}(1/2, 1/2) = 1/2

live ↗
InBetaRegularized⁡(0.5,12,12)\operatorname{BetaRegularized}(0.5, \frac{1}{2}, \frac{1}{2})Out0.50.5

Ix(1,1)=xI_x(1, 1) = x symbolically

live ↗
InBetaRegularized⁡(x,1,1)\operatorname{BetaRegularized}(x, 1, 1)Outxx

Ix(a,1)=xaI_x(a, 1) = x^a symbolically

live ↗
InBetaRegularized⁡(x,a,1)\operatorname{BetaRegularized}(x, a, 1)Outxax^{a}

Ix(1,b)=1−(1−x)bI_x(1, b) = 1 - (1-x)^b

live ↗
InBetaRegularized⁡(x,1,b)\operatorname{BetaRegularized}(x, 1, b)Out1−(1−x)b1-(1-x)^{b}
Possible issues #

Past x=1x = 1 the function continues analytically: at integer aa and bb it is the polynomial ∑j=aa+b−1(a+b−1j)xj(1−x)a+b−1−j\sum_{j=a}^{a+b-1}\binom{a+b-1}{j}x^j(1-x)^{a+b-1-j}

live ↗
InBetaRegularized⁡(2,2,3)\operatorname{BetaRegularized}(2, 2, 3)Out88
About
Examples22
Checked againstWolfram Language 20 agree2 differSymPy 19 agree1 differJulia 15 agree1 errorRust 13 agree3 error
CrosswalkWolfram LanguageSymPyJuliaRust

Implementation

mappedsympypackages/oracle/src/mappings.ts

SymPy's betainc_regularized(a, b, x1, x2) is the integral between two limits, so the lower limit is 0 and the arguments reorder.

mappedjuliapackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts

The crate takes a, b, then the point.

See also: Beta, GammaRegularized, Binomial