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



Task

Given   n,   find the   nth   roots of unity.




def rootsOfUnity(n:Int)=for(k <- 0 until n) yield Complex.fromPolar(1.0, 2*math.Pi*k/n)