What this calculator does
This tool evaluates the lower incomplete beta function, defined as the definite integral \(B_x(a,b) = \int_{0}^{x} t^{a-1}(1-t)^{b-1}\, dt\). The integrand \(t^{a-1}(1-t)^{b-1}\) is the kernel of the beta and beta-binomial distributions. When the upper limit \(x = 1\) (with lower limit 0), the result equals the complete beta function \(B(a,b) = \Gamma(a)\Gamma(b)/\Gamma(a+b)\).
How to use it
Enter the two shape parameters: a (variable a) and b. Both should be positive. Set the integration interval lower bound and the upper bound x (typically between 0 and 1). Choose the number of divisions n — the count of Gauss-Legendre nodes. Higher n gives more accuracy; n = 20 is plenty for smooth integrands. Leave the interval at [0, 1] to obtain the complete beta function.
The formula explained
The integral is computed with Gauss-Legendre quadrature. Standard nodes \(x_i\) and weights \(w_i\) on [-1, 1] are generated as roots of the Legendre polynomial \(P_n\) using Newton's method, then linearly mapped to the chosen interval \([c, d]\): $$t_i = \frac{d-c}{2}\cdot x_i + \frac{d+c}{2}.$$ The integral is then approximated by $$\frac{d-c}{2}\cdot \sum w_i\, f(t_i).$$ Because Gauss-Legendre integrates polynomials of degree up to \(2n-1\) exactly, it converges extremely fast for smooth integrands.
Worked example
With a = 3, b = 5, interval [0, 1] and n = 20, the result is the complete beta function $$B(3,5) = \frac{2! \cdot 4!}{7!} = \frac{48}{5040} = 0.0095238095\ldots = \frac{1}{105}.$$ The quadrature reproduces this to full double precision.
FAQ
What if \(0 < a < 1\) or \(0 < b < 1\)? The integrand has an integrable singularity at an endpoint. Gauss-Legendre nodes are interior, so the result stays finite, but accuracy drops — raise n.
How do I get the regularized incomplete beta \(I_x(a,b)\)? Divide this result by the complete beta function (compute it by setting the interval to [0, 1]).
Why is the result negative sometimes? If the upper limit is below the lower limit, the signed integral is negative, which is mathematically correct.