Home C&C++函数库 c++ 语法 程序源码 Linux C库

std::

polar

函数模板  <complex>

template<class T> complex<T> polar (const T& rho, const T& theta = 0);

从相角和幅值生成复数
返回一个复数对象(以笛卡尔格式),即由幅值rho和相位角theta定义的复数,其中rho是绝对大小,theta是相位角。 返回值中的值等同于:
real = rho * cos(theta);
imag = rho * sin(theta);

☲  参数


rho
复数的幅值。

theta
复数的相位角。

T是复数类型(即它的值类型)组件的类型。

☉  返回值



复数笛卡尔坐标。

☣  示例



// polar example
#include <iostream>     // std::cout
#include <complex>      // std::complex, std::polar

int main ()
{
  std::cout << "The complex whose magnitude is " << 2.0;
  std::cout << " and phase angle is " << 0.5;
  std::cout << " is " << std::polar (2.0, 0.5) << '\n';

  return 0;
}

输出:
The complex whose magnitude is 2 and phase angle is 0.5 is (1.75517,0.958851)

🍄  另请参阅



abs 复数的绝对值(函数模板)
arg 复数的相位角(函数模板)

联系我们 免责声明 关于CandCplus 网站地图