Feigenbaum constant calculation: Difference between revisions
Content added Content deleted
m (→{{header|Ring}}: added zkl header) |
(→{{header|zkl}}: added code) |
||
Line 164: | Line 164: | ||
=={{header|zkl}}== |
=={{header|zkl}}== |
||
{{trans|Kotlin}} |
|||
⚫ | |||
<lang zkl> |
<lang zkl>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; |
|||
} |
|||
⚫ | |||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
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 |
|||
</pre> |
</pre> |