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



Task

Given   n,   find the   nth   roots of unity.




 CLS
 PI = 3.1415926#
 n = 5 'this can be changed for any desired n
 angle = 0 'start at angle 0
 DO
 	real = COS(angle) 'real axis is the x axis
 	IF (ABS(real) < 10 ^ -5) THEN real = 0 'get rid of annoying sci notation
 	imag = SIN(angle) 'imaginary axis is the y axis
 	IF (ABS(imag) < 10 ^ -5) THEN imag = 0 'get rid of annoying sci notation
 	PRINT real; "+"; imag; "i" 'answer on every line
 	angle = angle + (2 * PI) / n
 'all the way around the circle at even intervals
 LOOP WHILE angle < 2 * PI