#MATL, 16 14 bytes
As I'm not terribly fluent with MATL I expect that this is somewhat more golfable. (Would be nice to at least beat Mathematica :-) I.e. the use of clipboards is not optimal as well as the flip w
whichis not optimal, it could probably be avoided...
:G/4*Jw^2Z^!XG
Test it Online! (Thanks @Suever for this service, thanks @DrMcMoylex for -2 bytes.)
Explanation (for N=3
):
: Generate Range 1:input: [1,2,3]
G/ Divide By the first input [0.333,0.666,1]
4* Multiply by 4 [1.33,2.66,4.0]
Jw^ i ^ (the result so far) [-0.49+ 0.86i,-.5-0.86i,1.00]
(This results in a list of the n-th roots of unity)
2Z^ Take the cartesian product with itself (i.e. generate all 2-tuples of those points)
!XG Transpose and plot
It is worth noting that for generating the N-th roots of unity you can use the formula exp(2*pi*i*k/N)
for k=1,2,3,...,N
. But since exp(pi*i/2) = i
you could also write i^(4*k/N)
for k=1,2,3,...,N
which is what I'm doing here.