Feigenbaum constant calculation: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 514: | Line 514: | ||
12 4.66920099 |
12 4.66920099 |
||
13 4.66920555</pre> |
13 4.66920555</pre> |
||
=={{header|Delphi}}== |
|||
{{works with|Delphi|6.0}} |
|||
{{libheader|SysUtils,StdCtrls}} |
|||
Translated from Algol |
|||
<syntaxhighlight lang="Delphi"> |
|||
procedure FeigenbaumConstant(Memo: TMemo); |
|||
{ Calculate the Feigenbaum constant } |
|||
const IMax = 13; |
|||
const JMax = 10; |
|||
var I,J,K: integer; |
|||
var A1,A2,D1,X,Y: double; |
|||
var A,D: double; |
|||
begin |
|||
Memo.Lines.Add('Feigenbaum constant calculation:'); |
|||
{Set initial starting values for iterations} |
|||
A1:=1.0; A2:=0.0; D1:=3.2; |
|||
Memo.Lines.Add(' I A D'); |
|||
for I:=2 to IMax do |
|||
begin |
|||
{Find next Bifurcation parameter, A} |
|||
A:=A1 + (A1 - A2) / D1; |
|||
for J:=1 to JMax do |
|||
begin |
|||
X:=0; Y:=0; |
|||
for K:=1 to 1 shl i do |
|||
begin |
|||
Y:=1 - 2 * y * x; |
|||
X:=A - X * X |
|||
end; |
|||
A:=A - X / Y |
|||
end; |
|||
{Use current and previous values of A} |
|||
{to calculate the Feigenbaum constant D } |
|||
D:= (A1 - A2) / (A - A1); |
|||
Memo.Lines.Add(Format('%2d %2.8f %2.8f',[I,A,D])); |
|||
D1:=D; A2:=A1; A1:=A; |
|||
end; |
|||
end; |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
Feigenbaum constant calculation: |
|||
I A D |
|||
2 1.31070264 3.21851142 |
|||
3 1.38154748 4.38567760 |
|||
4 1.39694536 4.60094928 |
|||
5 1.40025308 4.65513050 |
|||
6 1.40096196 4.66611195 |
|||
7 1.40111380 4.66854858 |
|||
8 1.40114633 4.66906066 |
|||
9 1.40115329 4.66917155 |
|||
10 1.40115478 4.66919515 |
|||
11 1.40115510 4.66920028 |
|||
12 1.40115517 4.66920099 |
|||
13 1.40115519 4.66920555 |
|||
</pre> |
|||
=={{header|F#|F sharp}}== |
=={{header|F#|F sharp}}== |