numpy.sinh#
- numpy.sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'sinh'>#
双曲正弦, element-wise.
等价于
1/2 * (np.exp(x) - np.exp(-x))或者-1j * np.sin(1jx).- 参数:
- xarray_like
输入数组.
- outndarray, None, or tuple of ndarray and None, optional
结果存储到的位置.如果提供,它必须具有输入的广播到的形状. 如果未提供或为 None,则返回一个新分配的数组.一个元组(可能只能作为关键字参数)必须具有等于输出数量的长度.
- wherearray_like, optional
此条件在输入上进行广播.在条件为 True 的位置, out 数组将设置为 ufunc 结果.否则, out 数组将保留其原始值.请注意,如果通过默认值
out=None创建一个未初始化的 out 数组,则其中条件为 False 的位置将保持未初始化.- \kwargs
对于其他仅限关键字的参数,请参阅 ufunc docs .
- 返回:
- yndarray
对应的双曲正弦值.如果 x 是标量,则这是一个标量.
注释
如果提供了 out ,则该函数会将结果写入其中,并返回对 out 的引用.(参见示例)
参考
M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. New York, NY: Dover, 1972, pg. 83.
示例
>>> import numpy as np >>> np.sinh(0) 0.0 >>> np.sinh(np.pi*1j/2) 1j >>> np.sinh(np.pi*1j) # (exact value is 0) 1.2246063538223773e-016j >>> # Discrepancy due to vagaries of floating point arithmetic.
>>> # Example of providing the optional output parameter >>> out1 = np.array([0], dtype='d') >>> out2 = np.sinh([0.1], out1) >>> out2 is out1 True
>>> # Example of ValueError due to provision of shape mis-matched `out` >>> np.sinh(np.zeros((3,3)),np.zeros((2,2))) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: operands could not be broadcast together with shapes (3,3) (2,2)