% Will scan the iterates for the correct value
% of the control parameter that will return the value 
% 1/2 after n iterates
function critmu = findmu(n)

if (n==1)
    lowlim = 0.75;
else
    lowlim = findmu(n-1);
end


mu = linspace(lowlim,1,500);
delta = zeros(1,length(mu));
deltaprev = 1;
for j = 1:length(mu)
    [i x] = iterate(mu(j), 0.5, 2^n+1);
    delta = abs(x(2^n+1)-0.5);
    if( sign(delta) == sign(deltaprev) )
        deltaprev = delta;
    else
        critmu = mu(j);
        break;
    end
end