jax.numpy.arccos#

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

Compute element-wise inverse of trigonometric cosine of input.

JAX implementation of numpy.arccos.

Parameters:

x (ArrayLike) – input array or scalar.

Returns:

An array containing the inverse trigonometric cosine of each element of x in radians in the range [0, pi], promoting to inexact dtype.

Return type:

Array

Note

  • jnp.arccos returns nan when x is real-valued and not in the closed interval [-1, 1].

  • jnp.arccos follows the branch cut convention of numpy.arccos for complex inputs.

See also

Examples

>>> x = jnp.array([-2, -1, -0.5, 0, 0.5, 1, 2])
>>> with jnp.printoptions(precision=3, suppress=True):
...   jnp.arccos(x)
Array([  nan, 3.142, 2.094, 1.571, 1.047, 0.   ,   nan], dtype=float32)

For complex inputs:

>>> with jnp.printoptions(precision=3, suppress=True):
...   jnp.arccos(4-1j)
Array(0.252+2.097j, dtype=complex64, weak_type=True)