clear all
figure(301)
hold off
tx=[sqrt(2)/2-.3 sqrt(2)/2+.3];
plot(tx, sqrt(2)/2-(tx-sqrt(2)/2),'r-',tx+.05, sqrt(2)/2-(tx+.05-sqrt(2)/2)+.1,'r-','linewidth',2)
hold on
x=(sqrt(2)/2-.2):.01:(sqrt(2)/2+.2);
y=sqrt(1-x.^2);
plot(x,y,'r.','linewidth',2)
box off
axis off

clear all
P=[2/5 3/10 1/5 1/10];
%P=[1 1 1 1]/4;
%2*log(4)/5/log(2)
tau=[1 2 3 4];
T=P*tau';
H=P*(log(1./P))'/log(2);
R=H/T

p=P*[((tau-1)./tau)',([1 1 1 1]./tau)'];
p*(log(1./p))'/log(2)
