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



Task

Given   n,   find the   nth   roots of unity.




complex_roots:
   procedure (N);
   declare N fixed binary nonassignable;
   declare x float, c fixed decimal (10,8) complex;
   declare twopi float initial ((4*asin(1.0)));
 
   do x = 0 to twopi by twopi/N;
      c = complex(cos(x), sin(x));
      put skip list (c);
   end;
end complex_roots;
 
   1.00000000+0.00000000I   
   0.80901700+0.58778524I   
   0.30901697+0.95105654I   
  -0.30901703+0.95105648I   
  -0.80901706+0.58778518I   
  -1.00000000-0.00000008I   
  -0.80901694-0.58778536I   
  -0.30901709-0.95105648I   
   0.30901712-0.95105648I   
   0.80901724-0.58778494I   