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



Task

Given   n,   find the   nth   roots of unity.




 
roots[n] :=
{
    a = makeArray[[n], 0]
    alpha = 360/n degrees
    theta = 0 degrees
    for k = 0 to length[a] - 1
    {
        a@k = cos[theta] + i sin[theta]
        theta = theta + alpha
    }
    a
}
 