function sv = roundoffvec(N)
% MATLAB function demonstrating the impact of roundoff by adding 2N vectors
% that should sum up to zero in exact arithmetic
N = 2*N; 
x = []; y = []; sv = [0;0] % Initialize \emph{empty} vectors
for i=1:N
  px = cos((i-1)/N*2*pi);
  py = sin((i-1)/N*2*pi);
  x = [x;px]; y = [y;py];
  sv = sv + [px;py];
end
figure; quiver(zeros(N,1),zeros(N,1),x,y,'r');
title('Corners of regular polygon','fontsize',14);
xlabel('{\bf x}','fontsize',14);
ylabel('{\bf y}','fontsize',14);


