numpy.lib.scimath.arctanh#

lib.scimath.arctanh(x)[源]#

计算 x 的反双曲正切。

返回 arctanh(x) 的“主值”(有关此内容的描述,请参见 numpy.arctanh)。对于满足 abs(x) < 1 的实数 x,结果为实数。如果 abs(x) > 1,或 x 是复数,则结果为复数。最后,x = 1 返回 infx=-1 返回 -inf

参数:
x类数组

需要计算反双曲正切的值。

返回:
outndarray 或标量

x 值的反双曲正切。如果 x 是标量,则 out 也是标量;否则返回一个数组。

另请参阅

numpy.arctanh

注意

对于当实数 x 不在区间 (-1,1) 内时返回 NAN 的 arctanh(),请使用 numpy.arctanh(然而,后者对于 x = +/-1 会返回 +/-inf)。

示例

>>> import numpy as np
>>> np.set_printoptions(precision=4)
>>> np.emath.arctanh(0.5)
0.5493061443340549
>>> from numpy.testing import suppress_warnings
>>> with suppress_warnings() as sup:
...     sup.filter(RuntimeWarning)
...     np.emath.arctanh(np.eye(2))
array([[inf,  0.],
       [ 0., inf]])
>>> np.emath.arctanh([1j])
array([0.+0.7854j])