% Antti Hannukainen 1.3.2006
%
%
% Approximate the Feigenbaum - number with veary Crude - method
%
%


N= 1;
a = 2.5;

Del = 0.11;

A = [];

while a < 4
  
  log_period(a)

  if( log_period(a) > N)
    % Use bisection to find periodic doubling
    
    pd_a = a-Del
    pd_b = a
    
    for i=1:200
      
      pd_c = (pd_a+pd_b)/2;
      
      if( log_period(pd_c) > N)
	pd_b = pd_c;
      else
	pd_a = pd_c;
      end
      
      if( abs(pd_a-pd_b) < 1e-12 )
	Del = Del/4;
	A = [A pd_a];	
	A
	N = log_period(a);
	break;
      end
    end
  end
  
  if(N > 256)
    break;
  end
    
  a = a+Del;
end

Fe = [];

for i=1:1:(length(A)-2)
  
  Fe = [Fe (A(i+1)-A(i))/(A(i+2)-A(i+1))];
  
end

