
- C++ Basics
- C++ Home
- C++ Overview
- C++ Environment Setup
- C++ Basic Syntax
- C++ Comments
- C++ Data Types
- C++ Variable Types
- C++ Variable Scope
- C++ Constants/Literals
- C++ Modifier Types
- C++ Storage Classes
- C++ Operators
- C++ Loop Types
- C++ Decision Making
- C++ Functions
- C++ Numbers
- C++ Arrays
- C++ Strings
- C++ Pointers
- C++ References
- C++ Date & Time
- C++ Basic Input/Output
- C++ Data Structures
- C++ Object Oriented
- C++ Classes & Objects
- C++ Inheritance
- C++ Overloading
- C++ Polymorphism
- C++ Abstraction
- C++ Encapsulation
- C++ Interfaces
beta(), betaf() and betal() functions in C++ STL
The functions beta(), betaf() and betal() are built-in functions in the standard template library of C++. These functions are used to calculate the beta function of two positive real numbers.
The functions beta(), betaf() and betal() are built-in functions in the standard template library of C++. These functions are used to calculate the beta function of two positive real numbers.
$B(x,y)=\int_{0}^{1}t^{(x-1)}(1-t)^{(y-1)}dt$
beta()
The beta() function is used to deal with values of data type double i.e. it accepts the parameter of double type and returns are double value.
Syntax
double beta(double x, double y)
Parameters
x is a double value that gives the value of x in the beta function. y is a double value that gives the value of y in the beta function.
Returns a double value which is beta function result.
Example
#include <bits/stdc++.h> using namespace std; int main(){ double x = 4.93; double y = 5.01; double result = beta(x, y); cout<<"B("<<x<<" , "<<y<<") = "<<result<<"\n"; return 0; }
Output
B(4.93 , 5.01) = 0.00166054
betaf()
The betaf() function is used to deal with values of data type float i.e. it accepts the parameter of float type and returns are float value.
Syntax
float beta(float x, float y
Parameters
x is a float value that gives the value of x in the beta function. y is a float value that gives the value of y in the beta function.
Returns a float value which is beta function result.
Example
#include <bits/stdc++.h> using namespace std; int main(){ float x = 0.31; float y = 3.99; float result = betaf(x, y); cout<<"B("<<x<<" , "<<y<<") = "<<result<<"\n"; return 0; }
Output
B(0.31 , 3.99) = 1.93395
betal()
The betal() function is used to deal with values of data type long double i.e. it accepts the parameter of long double type and returns a long double value.
Syntax
long double beta(long double x, long double y)
Parameters
x is a long double value that gives the value of x in the beta function. y is a long double value that gives the value of y in the beta function.
Returns a long double value which is beta function result.
Example
#include <bits/stdc++.h> using namespace std; int main(){ long double x = 3453.35451; long double y = 9862.89651; long double result = betaf(x, y); cout<<"B("<<x<<" , "<<y<<") = "<<result<<"\n"; return 0; }
Output
B(3453.35 , 9862.9) = 4.39947e-3312
- Related Articles
- list cbegin() and cend() functions in C++ STL
- Binary Search functions in C++ STL
- Binary Search functions in C++ STL (binary_search, lower_bound and upper_bound)
- Find and print duplicate words in std::vector using STL functions using C++.
- Computing index using pointers returned by STL functions in C++
- If $\alpha+\beta=-2$ and $\alpha^3+\beta^3=-56$, then find the quadratic equation whose roots are $\alpha$ and $\beta$.
- What is Asset Beta or Unlevered Beta?
- If $\alpha$ and $\beta$ are the zeroes of a polynomial such that $\alpha+\beta=-6$ and $\alpha\beta=5$, then find the polynomial.
- Relation between Beta and Gamma Function
- Difference between Alpha and Beta Testing
- How to calculate the beta of an unlisted company? (Unlevering and relevering of beta)
- If $\alpha ,\ \beta$ are the zeroes of a polynomial, such that $\alpha+\beta=6$ and $\alpha\beta=4$, then write the polynomial.
- If $\alpha,\ \beta$ are the zeroes of $f( x)=px^2-2x+3p$ and $\alpha +\beta=\alpha\beta$, then find the value of $p$.
- If $\alpha$ and $\beta$ are zeroes of $x^2-4x+1$, then find the value of $\frac{1}{\alpha}+\frac{1}{\beta}-\alpha\beta$.
- Mathematical Functions in Python - Special Functions and Constants
