First, a mathematical interlude, short, and worth your while:
0 < a < 4, the logistic function
f(x) = ax(1-x) maps the interval [0,1] inside itself. This means that one can play the iteration game; for instance, if a=2, the initial value 0.3 becomes 0.42, then 0.4872, etc.
As the parameter
a increases, the quadratic function
f becomes more complicated in the following sense:
0 < a < 1all initial values iterate toward 0.
1 < a < 30 becomes repelling, but there is a new fixed point (a-1)/a that attracts all iterations.
3 < a < 1+sqrt(6)the new fixed point becomes repelling, but a cycle of 2 attracting points appears.
3.44949... < a < 3.54409...the 2-cycle becomes repelling, but a cycle of 4 attracting points appears.
Feigenbaum noticed that the lengths of these parameter intervals decrease at a rate that gets closer and closer to
4.6692..., the Feigenbaum constant. The wonderful discovery is that this period 2 bifurcation sequence is a general phenomenon shared by any function that (like the quadratic parabola) is increasing, then decreasing. This was one of the first reports on the universality of chaos.
Now for the challenge! Write the shortest possible code that computes the Feigenbaum constant to an accuracy of your choice. The point here is not to cheat the system by encoding a number that you googled, but to actually have the computer find the value. For reference, here is the constant to 30 digits: