Returns the natural logarithm of the complete beta function.

View versions (2)

Interface

#include <codecogs/maths/special/gamma/logbeta.h>

using namespace Maths::Special::Gamma;

Returns the natural logarithm of the complete beta function, which is fundamentally just

$$\ln( \Gamma(a)*\Gamma(b) / \Gamma(a+b) )$$
(1)

However when either a or b are large (typically above 8) then there are more appropriate methods of computing an accurate value efficiently. An illustration of this curve is given below: \graph a=0:20 b=1:5:5 .size=medium

Example:

#include <stdio.h>
#include <codecogs/maths/special/gamma/logbeta.h>
int main()
{
  double a[6] = { 0.5, 1.5, 2.5, 3.5, 9.0, 20.0 };
  double b[6] = { 0.5, 9.0, 5.0, 1500.0, 12.0, 15.0 };
  for( int i=0; i<6; i++ )
    printf( "logBeta( %.1f, %.1f ) = %f\n", a[i], b[i], Maths::Special::Gamma::logBeta( a[i], b[i] ) );
  return 0;
}

Output:

logBeta( 0.5, 0.5 ) = 1.144730
logBeta( 1.5, 9.0 ) = -3.456805
logBeta( 2.5, 5.0 ) = -4.071628
logBeta( 3.5, 1500.0 ) = -24.398212
logBeta( 9.0, 12.0 ) = -14.228706
logBeta( 20.0, 15.0 ) = -24.049722

References

DiDonato, A. R. and Morris, A. H. Algorithm 708: Significant Digit Computation of the Incomplete Beta Function Ratios. ACM Trans. Math. Softw. 18 (1993), 360-373.

Parameters

a
first symmetric argument to the complete beta function, a>0.
b
second symmetric argument to the complete beta function, b>0.
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

a
b
Result