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)
(函数)
对 valarray 的每个元素应用函数 std::atan
(函数模板)
C 文档 关于 catan