Computer >> 컴퓨터 >  >> 프로그램 작성 >> C++

C++ STL의 beta(), betaf() 및 betal() 함수

<시간/>

beta(), betaf() 및 betal() 함수는 C++의 표준 템플릿 라이브러리에 내장된 함수입니다. 이 함수는 두 개의 양의 실수의 베타 함수를 계산하는 데 사용됩니다.

함수 베타() , betaf() 및 betal()은 C++의 표준 템플릿 라이브러리에 내장된 함수입니다. 이 함수는 두 개의 양의 실수의 베타 함수를 계산하는 데 사용됩니다.

$B(x,y)=\int_{0}^{1}t^{(x-1)}(1-t)^{(y-1)}dt$

베타()

beta() 함수는 데이터 유형이 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 값을 반환합니다.

예시

#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() 함수는 데이터 유형 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 값입니다.

예시

#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() 함수는 데이터 유형 long double의 값을 처리하는 데 사용됩니다. 즉, long double 유형의 매개변수를 수락하고 long double 값을 반환합니다.

구문

롱 더블 베타(롱 더블 x, 롱 더블 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 값입니다.

예시

#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