在複數頭文件中定義了用於複數的acos()函數。該函數是acos()函數的複雜版本。此函數用於計算複數z的複數反餘弦,並返回複數z的反餘弦。
用法:
template<class T> complex<T> acos (const complex<T>& z );
參數:此方法接受代表複數的強製性參數z。
返回值:此函數返回複數z的反餘弦。
以下示例程序旨在說明C++中的acos()函數:
示例1:
// c++ program to demonstrate
// example of acos() function.
#include <bits/stdc++.h>
using namespace std;
// driver program
int main()
{
complex<double> complexnumber(-2.0, 0.0);
// use of acos() function for complex number
cout << "The acos of "
<< complexnumber
<< " is "
<< acos(complexnumber)
<< endl;
return 0;
}
輸出:
The acos of (-2,0) is (3.14159,-1.31696)
示例2:
// c++ program to demonstrate
// example of acos() function.
#include <bits/stdc++.h>
using namespace std;
// driver program
int main()
{
complex<double> complexnumber(-2.0, -0.0);
// use of acos() function for complex number
cout << "The acos of "
<< complexnumber
<< " is "
<< acos(complexnumber)
<< endl;
return 0;
}
輸出:
The acos of (-2,-0) is (3.14159,1.31696)
相關用法
- C++ complex exp()用法及代碼示例
- C++ complex tan()用法及代碼示例
- C++ complex cos()用法及代碼示例
- C++ complex log()用法及代碼示例
- C++ complex arg()用法及代碼示例
- C++ complex pow()用法及代碼示例
- C++ complex acosh()用法及代碼示例
- C++ complex atanh()用法及代碼示例
- C++ complex tanh()用法及代碼示例
- C++ complex asin()用法及代碼示例
- C++ complex sqrt()用法及代碼示例
- C++ complex sinh()用法及代碼示例
- C++ complex atan()用法及代碼示例
- C++ complex cosh()用法及代碼示例
- C++ complex polar()用法及代碼示例
注:本文由純淨天空篩選整理自bansal_rtk_大神的英文原創作品 acos() function for complex number in C++。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。