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)