C++ STL 中的 beta()、betaf() 和 betal() 函数
beta()、betaf() 和 betal() 函数是 C++ 标准模板库中的内置函数。这些函数用于计算两个正实数的 beta 函数。
**beta() 函数**、betaf() 和 betal() 函数是 C++ 标准模板库中的内置函数。这些函数用于计算两个正实数的 beta 函数。
$B(x,y)=\int_{0}^{1}t^{(x-1)}(1-t)^{(y-1)}dt$
beta()
beta() 函数用于处理 double 类型的值,即它接受 double 类型的参数并返回 double 值。
语法
double beta(double x, double y)
参数
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.
返回一个 double 值,即 beta 函数的结果。
示例
#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;
}输出
B(4.93 , 5.01) = 0.00166054
betaf()
betaf() 函数用于处理 float 类型的值,即它接受 float 类型的参数并返回 float 值。
语法
float beta(float x, float y
参数
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.
**返回**一个 float 值,即 beta 函数的结果。
示例
#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;
}输出
B(0.31 , 3.99) = 1.93395
betal()
betal() 函数用于处理 long double 类型的值,即它接受 long double 类型的参数并返回 long double 值。
语法
long double beta(long double x, long double y)
参数
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.
**返回**一个 long double 值,即 beta 函数的结果。
示例
#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;
}输出
B(3453.35 , 9862.9) = 4.39947e-3312
广告
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP