std::atan(std::complex)
来自 cppreference.cn
定义于头文件 <complex> |
||
template< class T > complex<T> atan( const complex<T>& z ); |
(since C++11) | |
计算复数值 z 的复数反正切。分支切割线存在于虚轴上的区间 [−i, +i] 之外。
目录 |
[edit] 参数
z | - | 复数值 |
[edit] 返回值
如果没有错误发生,则返回 z 的复数反正切,其值域沿虚轴无界,沿实轴在区间 [−π/2, +π/2] 内。
错误和特殊情况的处理方式如同操作通过 -i *
std::atanh(i * z) 实现,其中 i
是虚数单位。
[edit] 注意
反切线(或反正切)是多值函数,需要在复平面上进行分支切割。分支切割线通常放置在虚轴的线段 (-∞i,-i) 和 (+i,+∞i) 上。
反正切主值的数学定义是 atan z = -1 |
2 |
[edit] 示例
运行此代码
#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)
[edit] 参见
(C++11) |
计算复数的反正弦 (arcsin(z)) (function template) |
(C++11) |
计算复数的反余弦 (arccos(z)) (function template) |
计算复数的正切 (tan(z)) (function template) | |
(C++11)(C++11) |
计算反正切 (arctan(x)) (function) |
将函数 std::atan 应用于 valarray 的每个元素 (function template) | |
C 文档 关于 catan
|