angle¶
- array_api_extra.angle(z, /, *, deg=False, xp=None)¶
Return the angle of the complex argument.
- Parameters:
z (
object) – Input array. Real input is interpreted as having zero imaginary part.deg (
bool) – Return angle in degrees if True, radians if False (default).xp (
ModuleType|None) – The standard-compatible namespace for z. Default: infer.
- Returns:
The counterclockwise angle from the positive real axis on the complex plane in the range
(-pi, pi].- Return type:
See also
numpy.angleNumPy equivalent.
Examples
>>> import array_api_strict as xp >>> import array_api_extra as xpx >>> xpx.angle(xp.asarray([1.0, 1.0j, 1 + 1j]), xp=xp) Array([0. , 1.57079633, 0.78539816], dtype=array_api_strict.float64) >>> xpx.angle(xp.asarray([1.0, 1.0j, 1 + 1j]), deg=True, xp=xp) Array([ 0., 90., 45.], dtype=array_api_strict.float64)