numpy.lib.scimath.arctanh#
- lib.scimath.arctanh(x)[源代码]#
计算 x 的反双曲正切.
返回
arctanh(x)的“主值”(有关此的描述,请参见numpy.arctanh).对于满足abs(x) < 1的实数 x ,这是一个实数.如果 abs(x) > 1 ,或者如果 x 是复数,则结果是复数.最后, x = 1 返回inf,而x=-1返回-inf.- 参数:
- xarray_like
需要计算反双曲正切的值.
- 返回:
- outndarray 或标量
x 值的反双曲正切.如果 x 是标量,则 out 也是标量,否则返回一个数组.
注释
对于当实数 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])