start=2;
stop=40;
z=[1:stop];
z(2)=2;
err=[1:stop];

function out = iter(z,n)
	out=(2^(n-(1/2))) * sqrt( 1-sqrt(1- (4^(1-n)) * (z^2)) );
end

for n=start:stop-1
	z(n+1)=iter(z(n),n);
endfor

ideal=ones(1,stop).*pi;
err=abs(ideal.-z);
n=1:stop;

%gset term epslatex
gset term postscript
gset output "p6_fig1.ps"
semilogy(n(start:stop),err(start:stop))
gset term x11

z
err
