jax.numpy.arctan#

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

计算输入的三角正切的元素级反函数。

JAX 对 numpy.arctan 的实现。

参数:

x (ArrayLike) – 输入数组或标量。

返回:

一个数组,包含 x 中每个元素的反正切值,以弧度为单位,范围为 [-pi/2, pi/2],并提升为非精确数据类型。

返回类型:

数组

注意

jnp.arctan 遵循复数输入的 numpy.arctan 的分支切割约定。

另请参阅

示例

>>> x = jnp.array([-jnp.inf, -20, -1, 0, 1, 20, jnp.inf])
>>> with jnp.printoptions(precision=3, suppress=True):
...   jnp.arctan(x)
Array([-1.571, -1.521, -0.785,  0.   ,  0.785,  1.521,  1.571], dtype=float32)

对于复数值输入

>>> with jnp.printoptions(precision=3, suppress=True):
...   jnp.arctan(2+7j)
Array(1.532+0.133j, dtype=complex64, weak_type=True)