numpy.sinh#
- numpy.sinh(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'sinh'>#
逐元素計算雙曲正弦值。
等效於
1/2 * (np.exp(x) - np.exp(-x))
或-1j * np.sin(1j*x)
。- 參數:
- xarray_like
輸入陣列。
- outndarray, None, 或 ndarray 和 None 的元組,選用
用於儲存結果的位置。如果提供,則必須具有輸入廣播到的形狀。如果未提供或為 None,則會傳回新分配的陣列。元組(可能僅作為關鍵字引數)的長度必須等於輸出的數量。
- wherearray_like,選用
此條件會廣播到輸入。在條件為 True 的位置,out 陣列將設定為 ufunc 結果。在其他位置,out 陣列將保留其原始值。請注意,如果透過預設
out=None
建立未初始化的 out 陣列,則條件為 False 的位置將保持未初始化。- **kwargs
對於其他僅限關鍵字引數,請參閱 ufunc 文件。
- 返回:
- yndarray
對應的雙曲正弦值。如果 x 是純量,則這是一個純量。
註解
如果提供 out,則函數會將結果寫入其中,並傳回對 out 的參考。(請參閱範例)
參考文獻
M. Abramowitz 和 I. A. Stegun,《數學函數手冊》。紐約,紐約州:Dover,1972 年,第 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)