Feigenbaum constant calculation: Difference between revisions

no edit summary
(add RPL)
No edit summary
Line 1,233:
12 4.66920098
13 4.66920537</pre>
 
=={{header|M2000 Interpreter}}==
Using decimal type (26 decimal places) is better for this calculation (this has the same output as FORTRAN). Variable maxitj can be change to lower values when the i get higher value. Although we can go lower than 2. So here we can start with 13, and lower to 2 for 18th iteration of i
 
<syntaxhighlight lang="m2000 interpreter">
module Feigenbaum_constant_calculation (maxit as integer, c as single){
locale 1033 // show dot for decimal separator symbol
single maxitj=13
integer i, j
long k
decimal a1=1, a2, d , d1=3.2, y, x, a
print "Feigenbaum constant calculation:"
print
print format$("{0:-7} {1:-12}","i", "d")
for i = 2 to maxit
a=a1+(a1-a2)/d1
for j = 1 to maxitj {x=0:y=0:for k=1 to 2&^i {y=1@-2@*y*x:x=a-x*x}:a-=x/y}:maxitj-=c
d=(a1-a2)/(a-a1)
print format$("{0::-7} {1:10:-12}",i, d)
d1=d:a2=a1:a1= a
next
}
Feigenbaum_constant_calculation 18, .7~
</syntaxhighlight>
{{out}}
<pre>
i d
2 3.2185114220
3 4.3856775986
4 4.6009492765
5 4.6551304954
6 4.6661119478
7 4.6685485814
8 4.6690606606
9 4.6691715554
10 4.6691951560
11 4.6692002291
12 4.6692013133
13 4.6692015458
14 4.6692015955
15 4.6692016062
16 4.6692016085
17 4.6692016090
18 4.6692016091
</pre>
 
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
404

edits