numpy.emath.arctanh#
- emath.arctanh(x)[source]#
計算 x 的反雙曲正切值。
傳回
arctanh(x)
的「主值」(關於此描述,請參閱numpy.arctanh
)。對於實數 x 且abs(x) < 1
,這會是實數。如果 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])