The beta(), betaf() and betal() are built-in functions in C++ STL that are used to compute the beta functionof two positive real values. The function takes two variables x and y as input and returns the beta function of x and y. Beta function (Also known as Euler integral of first kind) of x and y can be defined as:
double beta(double x, double y) or long double betal(long double x, long double y) or float betaf(float x, float y)
Parameters: The function accepts two mandatory parameters x and y which specifies the values of a floating-point or integral type. The parameters can be of double, double or float, float or long double, long double data-type.
Return Value: The function returns the value of beta function of x and y. The return type depends on the parameters passed. It is same as that of the parameter.
Note: The function runs in and above C++ 17(7.1).
Below program illustrates the beta(), betaf() and betal() functions:
0.00357143 0.00034965 1.65804e-005
Application of Beta function: It is used to compute Binomial Coefficients.The binomial coefficient in terms of beta function can be expressed as:
The above relation can be used to compute the binomial coeeficient. An illustration has been shown below:
- Functions in C/C++
- C++ Mathematical Functions
- List in C++ | Set 2 (Some Useful Functions)
- Inline Functions in C++
- Macros vs Functions
- Searching in a map using std::map functions in C++
- Functions that cannot be overloaded in C++
- Pure Functions
- Return from void functions in C++
- Const member functions in C++
- How arrays are passed to functions in C/C++
- Ceil and Floor functions in C++
- Builtin functions of GCC compiler
- strdup() and strndup() functions in C/C++
- __builtin_inf() functions of GCC compiler
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.