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:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Functions in C/C++
- Macros vs Functions
- List in C++ | Set 2 (Some Useful Functions)
- Pure Functions
- Functions that cannot be overloaded in C++
- Searching in a map using std::map functions in C++
- C++ Mathematical Functions
- Inline Functions in C++
- Methods vs. Functions in C++ with Examples
- __builtin_inf() functions of GCC compiler
- 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
- asin() and atan() functions in C/C++ with Example
- abs(), labs(), llabs() functions in C/C++
- strdup() and strndup() functions in C/C++
- C Library math.h functions
- erf | Error functions using cmath in C++
- Can virtual functions be private in C++?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.