Python 3.6+cmathterm
cmath.tau
constants
The number τ = 2π in the cmath module: a float, one full turn in radians. The same value as math.tau.
Syntax
cmath.tau
In cmath it is handy for roots of unity: the k-th root of degree n is rect(1, tau * k / n). It is a float, not a complex, and a separate object from math.tau with the same value. The roots of unity come out inexact, so round them before printing.
Examples
import cmath
roots = [cmath.rect(1, cmath.tau * k / 4) for k in range(4)]
print([complex(round(z.real, 9), round(z.imag, 9)) for z in roots]) # → [(1+0j), 1j, (-1+0j), -1j]
See also
Open in the full glossarydocs.python.orgReport an inaccuracy