dpnp.arctan2

dpnp.arctan2(x1, x2, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)

Calculates the inverse tangent of the quotient x1_i/x2_i for each element x1_i of the input array x1 with the respective element x2_i of the input array x2. Each element-wise result is expressed in radians.

Note that dpnp.atan2 is an alias of dpnp.arctan2. This function is not defined for complex-valued arguments; for the so-called argument of complex values, use dpnp.angle.

For full documentation refer to numpy.arctan2.

Parameters:
  • x1 ({dpnp.ndarray, usm_ndarray, scalar}) -- First input array, expected to have a real-valued floating-point data type. Both inputs x1 and x2 can not be scalars at the same time.

  • x2 ({dpnp.ndarray, usm_ndarray, scalar}) -- Second input array, also expected to have a real-valued floating-point data type. Both inputs x1 and x2 can not be scalars at the same time.

  • out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Output array to populate. Array must have the correct shape and the expected data type. Default: None.

  • order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array, if parameter out is None. Default: "K".

Returns:

out -- An array containing the inverse tangent of the quotient x1/x2. The returned array must have a real-valued floating-point data type determined by Type Promotion Rules.

Return type:

dpnp.ndarray

Limitations

Parameters where and subok are supported with their default values. Keyword arguments kwargs are currently unsupported. Otherwise NotImplementedError exception will be raised.

See also

dpnp.arctan

Trigonometric inverse tangent, element-wise.

dpnp.tan

Compute tangent element-wise.

dpnp.angle

Return the angle of the complex argument.

dpnp.arcsin

Trigonometric inverse sine, element-wise.

dpnp.arccos

Trigonometric inverse cosine, element-wise.

dpnp.arctanh

Inverse hyperbolic tangent, element-wise.

Examples

>>> import dpnp as np
>>> x1 = np.array([1., -1.])
>>> x2 = np.array([0., 0.])
>>> np.arctan2(x1, x2)
array([1.57079633, -1.57079633])
>>> x1 = np.array([0., 0., np.inf])
>>> x2 = np.array([+0., -0., np.inf])
>>> np.arctan2(x1, x2)
array([0.0 , 3.14159265, 0.78539816])
>>> x1 = np.array([-1, +1, +1, -1])
>>> x2 = np.array([-1, -1, +1, +1])
>>> np.arctan2(x1, x2) * 180 / np.pi
array([-135.,  -45.,   45.,  135.])