Task

Calculate the Feigenbaum constant.



See

   Details in the Wikipedia article:   Feigenbaum constant.


maxIt = 13 : maxItj = 13
a1 = 1.0 : a2 = 0.0 : d = 0.0 : d1 = 3.2
 
print "Feigenbaum constant calculation:"
print
print "  i      d"
print "======================"
 
for i = 2 to maxIt
    a = a1 + (a1 - a2) / d1
    for j = 1 to maxItj
        x = 0.0 : y = 0.0
        for k = 1 to 2 ^ i
            y = 1 - 2 * y * x
            x = a - x * x
        next k
        a -= x / y
    next j
    d = (a1 - a2) / (a - a1)
    print rjust(i,3); chr(9); ljust(d,13,"0")
    d1 = d
    a2 = a1
    a1 = a
next i