Feigenbaum constant calculation: Difference between revisions
Content added Content deleted
(Add Swift) |
m (→{{header|REXX}}: added an arrow indicating the last (correct) decimal digit (true value), added/changed whitespace and comments.) |
||
Line 1,089: | Line 1,089: | ||
if maxJ=='' | maxJ=="," then maxJ= 10 /* " " " " " " */ |
if maxJ=='' | maxJ=="," then maxJ= 10 /* " " " " " " */ |
||
#= 4.669201609102990671853203820466201617258185577475768632745651343004134330211314737138, |
#= 4.669201609102990671853203820466201617258185577475768632745651343004134330211314737138, |
||
|| 68974402394801381716 /*◄──Feigenbaum's constant, true value.*/ |
|||
numeric digits digs /*use the specified # of decimal digits*/ |
numeric digits digs /*use the specified # of decimal digits*/ |
||
a1= 1 |
a1= 1 |
||
Line 1,096: | Line 1,096: | ||
say 'Using ' maxJ " iterations for maxJ, with " digs ' decimal digits:' |
say 'Using ' maxJ " iterations for maxJ, with " digs ' decimal digits:' |
||
say |
say |
||
say copies(' ', 9) center( |
say copies(' ', 9) center("correct", 11) copies(' ', digs+1) |
||
say center('i', 9, "─") center('digits' , 11, |
say center('i', 9, "─") center('digits' , 11, "─") center('d', digs+1, "─") |
||
do i=2 for maxi-1 |
do i=2 for maxi-1 |
||
Line 1,113: | Line 1,113: | ||
parse value d a1 a with d1 a2 a1 /*assign 3 variables with 3 new values.*/ |
parse value d a1 a with d1 a2 a1 /*assign 3 variables with 3 new values.*/ |
||
end /*i*/ |
end /*i*/ |
||
/*stick a fork in it, we're all done. */ |
|||
say left('', 9 + 1 + 11 + 1 + t )"↑" /*show position of greatest accuracy. */ |
|||
say ' true value= ' # / 1 /*true value of Feigenbaum's constant. */</lang> |
say ' true value= ' # / 1 /*true value of Feigenbaum's constant. */</lang> |
||
{{out|output|text= when using the default inputs:}} |
{{out|output|text= when using the default inputs:}} |
||
Line 1,140: | Line 1,141: | ||
19 10 4.66920160909687888294310165196 |
19 10 4.66920160909687888294310165196 |
||
20 12 4.66920160910169069039564432665 |
20 12 4.66920160910169069039564432665 |
||
↑ |
|||
true value= 4.66920160910299067185320382047 |
true value= 4.66920160910299067185320382047 |
||
</pre> |
</pre> |