function S=SiciakRegularPolygon(X,Y,m)
%__________________________________________________________________________
% computes the Siciak-Zaharjuta extremal function for a regular polygon 
%inscribed in  the unit circle
%__________________________________________________________________________
%----- INPUT-------------
% X Y    grid for evaluating the function Ex:
%        x=-L:step:L,[X,Y]=meshgrid(x,x)
% m      number of sides of polygon
%-----OUTPUT--------------
% S      S(i,j)=S(X(i,j),Y(i,j)).
%__________________________________________________________________________
a=(cos(pi/m))^(-1);
bx=a.*cos(pi/(m).*(1:2:2*m-1));
by=a.*sin(pi/(m).*(1:2:2*m-1));
% modulus of Joukowski function
H=@(z) abs(z+(z.^2-1).^(1/2));
S=ones(size(X));
for j=1:length(bx)%2*m
    S=max(H(X.*bx(j)+Y.*by(j)),S);
end
%S=log(S);
end