Evaluates the Beta function.

View versions (1)

Interface

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

using namespace Maths::Special::Gamma;

This component evaluates the (complete) Beta integral with given parameters, defined by

B(x, y) = \frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}
(1)

The following properties also hold

B(x, y) = B(y, x) \qquad 
B(x, y) = \int_0^1 t^{x-1} (1-t)^{y-1} \mathrm{d}t
(2)

As an illustration of the shape of this function, the following graph show the variation over a wide range of x, but small y: \graph x=0.2:10 y=0.1:0.5:5 .size=medium

Example 1

#include <codecogs/maths/special/gamma/beta.h>
#include <iostream>
#include <iomanip>

int main()
{
  std::cout << std::setprecision(10);
  for (double x = 3; x < 5; x += 0.2)
  {
    std::cout << "Beta(" << x << ", 3.3) = ";
    std::cout << Maths::Special::Gamma::beta(x, 3.3) << std::endl;
  }
  return 0;
}

Output:

Beta(3, 3.3) = 0.02659326924
Beta(3.2, 3.3) = 0.02259427655
Beta(3.4, 3.3) = 0.01935107719
Beta(3.6, 3.3) = 0.01669372181
Beta(3.8, 3.3) = 0.0144961426
Beta(4, 3.3) = 0.01266346154
Beta(4.2, 3.3) = 0.01112333615
Beta(4.4, 3.3) = 0.00981994962
Beta(4.6, 3.3) = 0.008709767899
Beta(4.8, 3.3) = 0.007758498858

Parameters

x
the first argument of the function. Must be positive (x>0).
y
the second argument of the function. Must be positive (x>0).

Returns

An approximation of the Beta function

References

John Burkardt's library of statistical C++ routines, http://www.csit.fsu.edu/~burkardt/cpp_src/prob/prob.html

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

x
y
Result