Golden ratio/Convergence: Difference between revisions
Content added Content deleted
SqrtNegInf (talk | contribs) (Added Perl) |
(J) |
||
Line 917: | Line 917: | ||
14 iterations |
14 iterations |
||
The error is approximately -1.201864649e-06</pre> |
The error is approximately -1.201864649e-06</pre> |
||
=={{header|J}}== |
|||
(Using IEEE754 64 bit binary floating point, of course): |
|||
<syntaxhighlight lang=J> (,({:p)-~{&p)>:1 i.~1e_5>:|2 -/\p=. 1&(+%)^:a:1 NB. iterations and error |
|||
14 _1.20186e_6</syntaxhighlight> |
|||
In other words, wait for the series to converge (33 iterations - a few microseconds), check the pairwise differences and calculate the discrepency. |
|||
=={{header|jq}}== |
=={{header|jq}}== |