
% Try different values of a and then the effect on the resulting curves ! 

%a = 3.0;
%a = 3.45;
%a = 3.56;
%a = 3.5699;
%a = 3.56994567;
a = 3.56994567187094490184200515138649893676;
%a = 1 + sqrt(8);
logistic = @(x) a.*x.*(1-x);

% Focus on the behaviour around 0.5... 
% But you can increase the range up to [0 1]
x_min = 0.45; 
x_max =  0.55;

x = linspace(x_min, x_max, 100000); 
for k=0:10
    y = x;
    for l=1:2^k
        y = logistic(y);
    end
    plot(x, y,'DisplayName',['f^{2^{' num2str(k), '}}']);
    hold on;
    xlabel('x')
    ylabel('Iterated maps')
    legend
    xlim([x_min x_max]);
    drawnow; pause(1);
end
plot(x,x, 'k--', 'LineWidth', 0.5,'DisplayName','y=x');
