jax.numpy.cosh
Contents
jax.numpy.cosh#
- jax.numpy.cosh(x,/)[source]#
Calculate element-wise hyperbolic cosine of input.
JAX implementation of
numpy.cosh.The hyperbolic cosine is defined by:
\[cosh(x) = \frac{e^x + e^{-x}}{2}\]- Parameters:
x (ArrayLike) – input array or scalar.
- Returns:
An array containing the hyperbolic cosine of each element of
x, promotingto inexact dtype.- Return type:
Note
jnp.coshis equivalent to computingjnp.cos(1j*x).See also
jax.numpy.sinh(): Computes the element-wise hyperbolic sine of the input.jax.numpy.tanh(): Computes the element-wise hyperbolic tangent of theinput.jax.numpy.arccosh(): Computes the element-wise inverse of hyperboliccosine of the input.
Examples
>>>x=jnp.array([[3,-1,0],...[4,7,-5]])>>>withjnp.printoptions(precision=3,suppress=True):...jnp.cosh(x)Array([[ 10.068, 1.543, 1. ], [ 27.308, 548.317, 74.21 ]], dtype=float32)>>>withjnp.printoptions(precision=3,suppress=True):...jnp.cos(1j*x)Array([[ 10.068+0.j, 1.543+0.j, 1. +0.j], [ 27.308+0.j, 548.317+0.j, 74.21 +0.j]], dtype=complex64, weak_type=True)
For complex-valued input:
>>>withjnp.printoptions(precision=3,suppress=True):...jnp.cosh(5+1j)Array(40.096+62.44j, dtype=complex64, weak_type=True)>>>withjnp.printoptions(precision=3,suppress=True):...jnp.cos(1j*(5+1j))Array(40.096+62.44j, dtype=complex64, weak_type=True)
Contents
