Namespaces
Variants

std:: atanh (std::complex)

From cppreference.net
定义于头文件 <complex>
template < class T >
complex < T > atanh ( const complex < T > & z ) ;
(C++11 起)

计算复数 z 的反双曲正切函数,其在实轴上沿区间 [−1; +1] 之外存在分支切割。

目录

参数

z - 复数值

返回值

若无错误发生,则返回 z 的复反双曲正切值,其取值范围为沿实轴数学无界、沿虚轴在区间 [−iπ/2; +iπ/2] 内的半带域。

错误处理与特殊值

错误报告遵循 math_errhandling 规范。

如果实现支持 IEEE 浮点运算,

  • std:: atanh ( std:: conj ( z ) ) == std:: conj ( std:: atanh ( z ) )
  • std:: atanh ( - z ) == - std:: atanh ( z )
  • z (+0,+0) ,则结果为 (+0,+0)
  • z (+0,NaN) ,则结果为 (+0,NaN)
  • z (+1,+0) ,则结果为 (+∞,+0) 并引发 FE_DIVBYZERO
  • z (x,+∞) (对于任意有限正数 x),则结果为 (+0,π/2)
  • z (x,NaN) (对于任意有限非零 x),则结果为 (NaN,NaN) 并可能引发 FE_INVALID
  • z (+∞,y) (对于任意有限正数 y),则结果为 (+0,π/2)
  • z (+∞,+∞) ,则结果为 (+0,π/2)
  • z (+∞,NaN) ,则结果为 (+0,NaN)
  • z (NaN,y) (对于任意有限 y),则结果为 (NaN,NaN) 并可能引发 FE_INVALID
  • z (NaN,+∞) ,则结果为 (±0,π/2) (实部符号未指定)
  • z (NaN,NaN) ,则结果为 (NaN,NaN)

注释

尽管C++标准将此函数命名为“复双曲反正切”,但双曲函数的反函数实际上是面积函数。其参数表示双曲扇形的面积,而非弧长。正确的名称应为“复反双曲正切”,较少使用的名称为“复面积双曲正切”。

反双曲正切是一个多值函数,需要在复平面上设置分支切割。按照惯例,分支切割通常设置在实轴的线段 (-∞,-1] [+1,+∞) 上。

The mathematical definition of the principal value of the inverse hyperbolic tangent is atanh z =
ln(1+z) - ln(1-z)
2
.
For any z , atanh(z) =
atan(iz)
i
.

示例

#include <complex>
#include <iostream>
int main()
{
    std::cout << std::fixed;
    std::complex<double> z1(2.0, 0.0);
    std::cout << "atanh" << z1 << " = " << std::atanh(z1) << '\n';
    std::complex<double> z2(2.0, -0.0);
    std::cout << "atanh" << z2 << " (the other side of the cut) = "
              << std::atanh(z2) << '\n';
    // for any z, atanh(z) = atanh(iz) / i
    std::complex<double> z3(1.0, 2.0);
    std::complex<double> i(0.0, 1.0);
    std::cout << "atanh" << z3 << " = " << std::atanh(z3) << '\n'
              << "atan" << z3 * i << " / i = " << std::atan(z3 * i) / i << '\n';
}

输出:

atanh(2.000000,0.000000) = (0.549306,1.570796)
atanh(2.000000,-0.000000) (the other side of the cut) = (0.549306,-1.570796)
atanh(1.000000,2.000000) = (0.173287,1.178097)
atan(-2.000000,1.000000) / i = (0.173287,1.178097)

参见

计算复数的反双曲正弦( arsinh(z)
(函数模板)
计算复数的反双曲余弦( arcosh(z)
(函数模板)
计算复数的双曲正切( tanh(z)
(函数模板)
(C++11) (C++11) (C++11)
计算反双曲正切( artanh(x)
(函数)
C 文档 关于 catanh