Feigenbaum constant calculation: Difference between revisions

m
→‎{{header|FutureBasic}}: Inserted code indents
m (syntax highlighting fixup automation)
m (→‎{{header|FutureBasic}}: Inserted code indents)
Line 724:
 
void local fn Feignenbaum
NSUInteger i, j, k
double a1 = 1.0, a2 = 0.0, d1 = 3.2
 
print "Feignenbaum Constant"
print " i d"
 
for i = 2 to _maxIt
double a = a1 + ( a1 - a2 ) / d1
for j = 1 to _maxItJ
double x = 0, y = 0
for k = 1 to fn pow( 2, i )
y = 1 - 2 * y * x
x = a - x * x
next
a = a - x / y
next
double d = ( a1 - a2 ) / ( a - a1 )
printf @"%2d. %.8f", i, d
d1 = d
a2 = a1
a1 = a
next
end fn
 
Line 752:
HandleEvents
</syntaxhighlight>
 
{{output}}
{{out}}
<pre>
Feignenbaum Constant
Line 769 ⟶ 770:
13 4.66920537
</pre>
 
 
=={{header|Go}}==
416

edits