C++ 中用于复数的 atan() 函数?

c++server side programmingprogramming

这里我们将看到用于复数的 atan() 方法。可以使用复数头文件来使用复数。在该头文件中还存在 atan() 函数。这是普通 atan() 函数的复数版本。它用于查找复数的复数反正切。

此函数以复数作为输入参数,并返回反正切作为输出。让我们看一个例子来了解这个想法。

示例

#include<iostream>
#include<complex>
using namespace std;
int main() {
   complex<double> c1(5, 2);
   //atan() function for complex number
   cout << "The atan() of " << c1<< " is "<< atan(c1);
}

输出

The atan() of (5,2) is (1.39928,0.067066)

相关文章