Beta Function B(a,b) Calculator
Compute the Beta function B(a,b)=∫_0^1 t^(a-1)(1-t)^(b-1)dt both by Gauss-Legendre numerical integration and the gamma form Γ(a)Γ(b)/Γ(a+b), with lnB and the agreement error.
Input
Enter positive reals a and b to integrate the Beta function B(a,b)=∫_0^1 t^(a-1)(1-t)^(b-1)dt with 64-point Gauss quadrature and compare it to the gamma form.
Positive real number
Positive real number
Result
Beta function B(2, 3) (numerical integral)
0.0833333333
Approximated with 64-point Gauss-Legendre quadrature
Gamma form Γ(a)Γ(b)/Γ(a+b)
0.0833333333
lnB(a,b)
-2.4849066498
Difference from integral
2.220446e-16
The gamma form B(a,b)=Γ(a)Γ(b)/Γ(a+b) is computed with the Lanczos approximation. When a or b is below 1 the integrand diverges at an endpoint, so the numerical integral carries more error.
How it works
- The Beta function is defined as B(a,b)=∫_0^1 t^(a-1)(1-t)^(b-1)dt; enter positive real numbers for a and b.
- The primary value comes from 64-point Gauss-Legendre quadrature, with the standard interval [-1,1] mapped linearly to [0,1].
- The gamma form is B(a,b)=Γ(a)Γ(b)/Γ(a+b), where the gamma function is evaluated with the Lanczos approximation.
- lnB(a,b)=lnΓ(a)+lnΓ(b)-lnΓ(a+b) is useful when you want to avoid overflow for large arguments.
- When a or b is below 1 the integrand diverges at an endpoint, so the numerical integral carries slightly more error than the gamma form.
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Beta Function B(a,b) Calculator