jax.numpy.sinh#
- jax.numpy.sinh(x, /)[原始碼]#
計算輸入的元素級雙曲正弦值。
JAX 實作的
numpy.sinh
。雙曲正弦的定義為
\[sinh(x) = \frac{e^x - e^{-x}}{2}\]- 參數:
x (ArrayLike) – 輸入陣列或純量。
- 傳回:
一個包含
x
每個元素的雙曲正弦值的陣列,並提升為非精確 dtype。- 傳回型別:
注意
jnp.sinh
等同於計算-1j * jnp.sin(1j * x)
。另請參閱
jax.numpy.cosh()
:計算輸入的元素級雙曲餘弦值。jax.numpy.tanh()
:計算輸入的元素級雙曲正切值。jax.numpy.arcsinh()
:計算輸入的元素級反雙曲正弦值。
範例
>>> x = jnp.array([[-2, 3, 5], ... [0, -1, 4]]) >>> with jnp.printoptions(precision=3, suppress=True): ... jnp.sinh(x) Array([[-3.627, 10.018, 74.203], [ 0. , -1.175, 27.29 ]], dtype=float32) >>> with jnp.printoptions(precision=3, suppress=True): ... -1j * jnp.sin(1j * x) Array([[-3.627+0.j, 10.018-0.j, 74.203-0.j], [ 0. -0.j, -1.175+0.j, 27.29 -0.j]], dtype=complex64, weak_type=True)
對於複數值輸入
>>> with jnp.printoptions(precision=3, suppress=True): ... jnp.sinh(3-2j) Array(-4.169-9.154j, dtype=complex64, weak_type=True) >>> with jnp.printoptions(precision=3, suppress=True): ... -1j * jnp.sin(1j * (3-2j)) Array(-4.169-9.154j, dtype=complex64, weak_type=True)