angle¶
- array_api_extra.angle(z, /, *, deg=False, xp=None)¶
Return the angle of the complex argument.
- Parameters:
z (Array) – Input array.
deg (bool, optional) – Return angle in degrees if True, radians if False (default).
xp (array_namespace, optional) – 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:
array
Notes
Real input
xis interpreted asx + 0j.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)