arg

arg(x)

Try it yourself:

See also:

arg(): The Direction of a Complex Number

arg() returns the argument, or angular direction, of a complex number. A complex value can be described by its horizontal real component and vertical imaginary component; arg tells you the angle of that point from the positive real axis. This polar representation is central to signal processing, phasors, and rotation.

Interpreting the result

The result is an angle in radians on a principal branch, commonly between −π and π. For example, arg(1) is 0, while arg(i) is π/2. The zero complex number has no defined direction, so do not expect a meaningful argument for it.

To inspect a complex number, use re() and im(). Its magnitude comes from abs(). Together, magnitude and argument form polar coordinates: z = abs(z) × (cos(arg(z)) + i sin(arg(z))).

Quadrants and phase

arg is effectively a complex-aware angle calculation and correctly handles quadrants. When you start with separate real and imaginary components, atan2() expresses the same directional idea. Avoid using plain atan(im/re) because division by zero and quadrant ambiguity can change the answer.

Arguments can jump by 2π at the principal-branch boundary. In phase measurements, that jump is normal; use phase unwrapping in downstream analysis when a continuous angle sequence is needed. Check reconstructions with cos() and sin().

All functions