clear all;
close all;

degree = 18;

numpoly = 2^(degree-1);

figure(1);
set(gcf, 'Position', [80, 80, 1080, 1080]);
rr = zeros(4*degree*numpoly,1);
for iter = 1:numpoly
    if mod(iter,numpoly/2^8) == 0 
        iter
    end
    i = iter;
    for j = 1:degree+1
        a(j) = mod(i,2);
        i = (i-a(j))/2;
    end
    a = 2*a-1;
    r = roots(a);
    rr(4*iter*degree         +1:4*iter*degree+  degree) = r;
    rr(4*iter*degree+degree  +1:4*iter*degree+2*degree) = -r;
    rr(4*iter*degree+2*degree+1:4*iter*degree+3*degree) = conj(r);
    rr(4*iter*degree+3*degree+1:4*iter*degree+4*degree) = conj(r);
    % rr = [rr; r; -r; conj(r); -conj(r)];
end
plot(rr,'Color',[0 0 0 0.4], 'Marker','.', 'MarkerSize',0.1, 'LineStyle','none');
axis('equal');
%print(gcf,'foo.png','-dpng','-r900');
