Namespaces
Variants

std:: atan (std::complex)

From cppreference.net
定義先ヘッダ <complex>
template < class T >
complex < T > atan ( const complex < T > & z ) ;
(C++11以降)

複素数の複素逆正接を計算します z 。分岐切断は虚軸に沿って区間 [−i, +i] の外側に存在します。

目次

パラメータ

z - 複素数値

戻り値

エラーが発生しない場合、複素数のアークタンジェントが z の値に対して返されます。その値は虚軸方向には非有界な帯域内にあり、実軸方向には区間 [−π/2, +π/2] 内に収まります。

エラーおよび特殊ケースは、この演算が - i * std::atanh ( i * z ) によって実装されているかのように処理されます。ここで i は虚数単位です。

注記

逆正接(またはアークタンジェント)は多価関数であり、複素平面上で分岐切断を必要とします。分岐切断は慣例的に、虚軸上の線分 (-∞i,-i) および (+i,+∞i) に配置されます。

The mathematical definition of the principal value of inverse tangent is atan z = -
1
2
i [ln(1 - iz) - ln (1 + iz)]
.

#include <cmath>
#include <complex>
#include <iostream>
int main()
{
    std::cout << std::fixed;
    std::complex<double> z1(0.0, 2.0);
    std::cout << "atan" << z1 << " = " << std::atan(z1) << '\n';
    std::complex<double> z2(-0.0, 2.0);
    std::cout << "atan" << z2 << " (the other side of the cut) = "
              << std::atan(z2) << '\n';
    std::complex<double> z3(0.0, INFINITY);
    std::cout << "2 * atan" << z3 << " = " << 2.0 * std::atan(z3) << '\n';
}

出力:

atan(0.000000,2.000000) = (1.570796,0.549306)
atan(-0.000000,2.000000) (the other side of the cut) = (-1.570796,0.549306)
2 * atan(0.000000,inf) = (3.141593,0.000000)

関連項目

複素数の逆正弦を計算する ( arcsin(z) )
(関数テンプレート)
複素数の逆余弦を計算する ( arccos(z) )
(関数テンプレート)
複素数の正接を計算する ( tan(z) )
(関数テンプレート)
(C++11) (C++11)
逆正接を計算する ( arctan(x) )
(関数)
関数 std::atan をvalarrayの各要素に適用する
(関数テンプレート)