Feigenbaum constant calculation

From Rosetta Code
Revision as of 18:37, 20 April 2018 by CalmoSoft (talk | contribs)

Feigenbaum constant calculation Calculate the Feigenbaum constant. See details: Feigenbaum constant

Ring

<lang ring>

  1. Project : Feigenbaum constant calculation
  2. Date  : 2018/04/20
  3. Author : Gal Zsolt [~ CalmoSoft ~]
  4. Email  : <calmosoft@gmail.com>

decimals(8) see "Feigenbaum constant calculation:" + nl maxIt = 13 maxItJ = 10 a_1 = 1.0 a_2 = 0.0 d_1 = 3.2 see "i " + "d" + nl for i = 2 to maxIt

    a = a_1 + (a_1 - a_2) / d_1
    for j = 1 to maxItJ
         x = 0
         y = 0
         for k = 1 to pow(2,i)
              y = 1 - 2 * y * x
              x = a - x * x 
         next   
         a = a - x / y
    next
    d = (a_1 - a_2) / (a - a_1)
    if i < 10
       see "" + i + "    " + d + nl
    else
       see "" + i + "  " + d + nl
    ok
    d_1 = d
    a_2 = a_1
    a_1 = a

next </lang> Output:

Feigenbaum constant calculation:
i  d
2  3.21851142
3  4.38567760
4  4.60094928
5  4.65513050
6  4.66611195
7  4.66854858
8  4.66906066
9  4.66917155
10 4.66919515
11 4.66920026
12 4.66920098
13 4.66920537