jax.numpy.arctanh#
- jax.numpy.arctanh(x, /)[source]#
Calculate element-wise inverse of hyperbolic tangent of input.
JAX implementation of
numpy.arctanh
.The inverse of hyperbolic tangent is defined by:
\[arctanh(x) = \frac{1}{2} [\ln(1 + x) - \ln(1 - x)]\]- Parameters:
x (ArrayLike) – input array or scalar.
- Returns:
An array of same shape as
x
containing the inverse of hyperbolic tangent of each element ofx
, promoting to inexact dtype.- Return type:
Note
jnp.arctanh
returnsnan
for real-values outside the range[-1, 1]
.jnp.arctanh
follows the branch cut convention ofnumpy.arctanh
for complex inputs.
See also
jax.numpy.tanh()
: Computes the element-wise hyperbolic tangent of the input.jax.numpy.arcsinh()
: Computes the element-wise inverse of hyperbolic sine of the input.jax.numpy.arccosh()
: Computes the element-wise inverse of hyperbolic cosine of the input.
Examples
>>> x = jnp.array([-2, -1, -0.5, 0, 0.5, 1, 2]) >>> with jnp.printoptions(precision=3, suppress=True): ... jnp.arctanh(x) Array([ nan, -inf, -0.549, 0. , 0.549, inf, nan], dtype=float32)
For complex-valued input:
>>> x1 = jnp.array([-2+0j, 3+0j, 4-1j]) >>> with jnp.printoptions(precision=3, suppress=True): ... jnp.arctanh(x1) Array([-0.549+1.571j, 0.347+1.571j, 0.239-1.509j], dtype=complex64)