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
xin radians in the range[0, pi], promoting to inexact dtype.- Return type:
Note
jnp.arccosreturnsnanwhenxis real-valued and not in the closed interval[-1, 1].jnp.arccosfollows the branch cut convention ofnumpy.arccosfor complex inputs.
See also
jax.numpy.cos(): Computes a trigonometric cosine of each element of input.jax.numpy.arcsin()andjax.numpy.asin(): Computes the inverse of trigonometric sine of each element of input.jax.numpy.arctan()andjax.numpy.atan(): Computes the inverse of trigonometric tangent of each element of input.
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)