Cpp-standard-library-cpp-complex-polar

提供:Dev Guides
移動先:案内検索

C ++複合ライブラリ-Polar

説明

極成分からの複素数であり、極成分rhoとthetaで定義される複素数に対応する(デカルト形式の)複雑なオブジェクトをrturnします。ここでrhoは大きさ(モジュラス)、thetaは位相角です。

宣言

以下は、std
polarの宣言です。
template<class T> complex<T> polar (const T& rho, const T& theta = 0);

C 11

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

パラメーター

  • rho 複素数の大きさ(モジュラス)です。
  • theta これは、複素数の位相角(角度成分)です。
  • T これは、複合タイプのコンポーネントのタイプです。

戻り値

rhoとthetaによって形成される極形式に相当する複雑なデカルト座標を返します。

例外

none

以下のstd
polarの例。
#include <iostream>
#include <complex>

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

   return 0;
}

サンプル出力は次のようになります-

The complex whose magnitude is 1
 and phase angle is 0.7
 is (0.764842,0.644218)