Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K
JAX  documentation - Home

jax.numpy.cosh

Contents

jax.numpy.cosh#

jax.numpy.cosh(x,/)[source]#

Calculate element-wise hyperbolic cosine of input.

JAX implementation ofnumpy.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 ofx, promotingto inexact dtype.

Return type:

Array

Note

jnp.cosh is equivalent to computingjnp.cos(1j*x).

See also

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

[8]ページ先頭

©2009-2025 Movatter.jp