fn
arctan2
→Tensorarctan2(y: Tensor, x: Tensor)Quadrant-correct two-argument arctangent.
Verbose alias of lucid.atan2. Returns the polar angle
of the point in the Cartesian plane,
resolving the correct quadrant from the signs of both arguments.
Parameters
yTensorOrdinate (imaginary / y-coordinate). Must broadcast with
x.xTensorAbscissa (real / x-coordinate). Must broadcast with
y.Returns
TensorElement-wise angle in radians on , with the
broadcast shape of y and x.
Notes
Mathematical definition:
The naive collapses both half-planes into
; arctan2 instead inspects the sign of
each argument to recover the full range, which
is essential for converting Cartesian to polar coordinates.
Examples
>>> import lucid
>>> y = lucid.tensor([1.0, 1.0, -1.0, -1.0])
>>> x = lucid.tensor([1.0, -1.0, -1.0, 1.0])
>>> lucid.arctan2(y, x)
Tensor([ 0.7854, 2.3562, -2.3562, -0.7854])