在複數頭文件中定義了用於複數的polar()函數,Polar函數用於從相角和幅值中查找複數。
用法:
polar(mag, angle)
參數:
- mag:它代表複數的大小。
- angle:它代表相位角。
返回值:該函數返回一個複數,該複數由相角和幅值獲得。
以下示例程序旨在說明上述函數:-
程序1:
// C++ program to demonstrate
// example of polar() function.
#include <bits/stdc++.h>
using namespace std;
// driver function
int main ()
{
cout << "The complex number whose magnitude is 4.0";
cout << " and phase angle 1.5";
// use of polar() function
cout << " is " << polar (4.0, 1.5) << endl;
return 0;
}
輸出:
The complex number whose magnitude is 4.0 and phase angle 1.5 is (0.282949,3.98998)
程序2:
// C++ program to demonstrate
// example of polar() function.
#include <bits/stdc++.h>
using namespace std;
// driver function
int main ()
{
cout << "The complex number whose magnitude is 2.0";
cout << " and phase angle 0.5";
// use of polar() function
cout << " is " << polar (2.0, 0.5) << endl;
return 0;
}
輸出:
The complex number whose magnitude is 2.0 and phase angle 0.5 is (1.75517,0.958851)
相關用法
- C++ complex tan()用法及代碼示例
- C++ complex cos()用法及代碼示例
- C++ complex pow()用法及代碼示例
- C++ complex abs()用法及代碼示例
- C++ complex exp()用法及代碼示例
- C++ complex arg()用法及代碼示例
- C++ complex log()用法及代碼示例
- C++ complex asinh()用法及代碼示例
- C++ complex tanh()用法及代碼示例
- C++ complex sinh()用法及代碼示例
- C++ complex log10()用法及代碼示例
- C++ complex atan()用法及代碼示例
- C++ complex atanh()用法及代碼示例
- C++ complex acos()用法及代碼示例
注:本文由純淨天空篩選整理自bansal_rtk_大神的英文原創作品 polar() function for complex number in C++。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。