The purpose of this task is to explore working with   complex numbers.



Task

Given   n,   find the   nth   roots of unity.




window 1, @"Roots of Unity", (0,0,1050,200)
 
long n, root
double real, imag
 
for n = 2 to 7
  print n;":" ;
  for root = 0 to n-1
    real = cos( 2 * pi * root / n)
    imag = sin( 2 * pi * root / n)
    print using "-##.#####"; real;using "-##.#####"; imag; "i";
    if root != n-1 then print ",";
  next
  print
next
 
HandleEvents