function logistic(a0,a1,da)
% Bifurcation diagram for the logistic map.  Usage:
% logistic(1,2,0.1) plots the diagram for 1 <= a <= 2 with a
% spacing of 0.1.  Number of points is a magic number in the
% source.

n0 = 1000;
n1 = 100;

figure;
hold on;

for a=a0:da:a1,
  
  %disp(['a=' num2str(a)]);
  x = rand(1);
  
  for i=1:n0,
    x = a*x*(1-x);
  end
  
  l = [x];
  for i=1:n1,
    x = a*x*(1-x);
    l = [l x];
  end
  
  plot(a,l,'k.','MarkerSize',1.4);
  
end
