Feigenbaum constant calculation: Difference between revisions
Content deleted Content added
Added c# |
|||
Line 287: | Line 287: | ||
12 4.66920098 |
12 4.66920098 |
||
13 4.66920537</pre> |
13 4.66920537</pre> |
||
=={{header|Phix}}== |
|||
{{trans|Ring}} |
|||
<lang Phix>constant maxIt = 13, |
|||
maxItJ = 10 |
|||
atom a1 = 1.0, |
|||
a2 = 0.0, |
|||
d1 = 3.2 |
|||
puts(1," i d\n") |
|||
for i=2 to maxIt do |
|||
atom a = a1 + (a1 - a2) / d1 |
|||
for j=1 to maxItJ do |
|||
atom x = 0, y = 0 |
|||
for k=1 to power(2,i) do |
|||
y = 1 - 2*y*x |
|||
x = a - x*x |
|||
end for |
|||
a = a - x/y |
|||
end for |
|||
atom d = (a1-a2)/(a-a1) |
|||
printf(1,"%2d %.8f\n",{i,d}) |
|||
d1 = d |
|||
a2 = a1 |
|||
a1 = a |
|||
end for</lang> |
|||
{{out}} |
|||
<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> |
|||
=={{header|Racket}}== |
=={{header|Racket}}== |