Task

Calculate the Feigenbaum constant.



See

   Details in the Wikipedia article:   Feigenbaum constant.


fcn feigenbaum{
   maxIt,maxItJ,a1,a2,d1,a,d := 13, 10, 1.0, 0.0, 3.2, 0, 0;
   println(" i       d");
   foreach i in ([2..maxIt]){
      a=a1 + (a1 - a2)/d1;
      foreach j in ([1..maxItJ]){
         x,y := 0.0, 0.0;
	 foreach k in ([1..(1).shiftLeft(i)]){ y,x = 1.0 - 2.0*y*x, a - x*x; }
	 a-=x/y
      }
      d=(a1 - a2)/(a - a1);
      println("%2d    %.8f".fmt(i,d));
      d1,a2,a1 = d,a1,a;
   }
}();