Talk:Arithmetic-geometric mean: Difference between revisions
m
Replacxed <lang> tags with <syntaxhighlight>
m (→rapidity of convergence: changed comments and whitespace, used a template for output.) |
m (Replacxed <lang> tags with <syntaxhighlight>) |
||
Line 39:
The referenced Mathworld page mentions that AGM is meaningful on the complex plane as well.
:It certainly has. It has been called The Mind of God (perhaps beyond the scope of this task!). There is a little more to it than adding +0i to the real solution. In Real Maths sqrt 4 is 2(This task assumes this). In fantasy maths sqrt 4 is 2 and -2. Then the next iteration takes the sqrt of a negative number, and maths goes complex. The result in Complex maths is the set of all these arithmetric geometric means.--[[User:Nigel Galloway|Nigel Galloway]] 14:20, 23 April 2012 (UTC)
<
import (
Line 47:
)
const ε = 1e-14</
==rapidity of convergence==
Line 59:
The modified REXX program is:
<
parse arg a b digs . /*obtain optional numbers from the C.L.*/
if digs=='' | digs=="," then digs=100 /*No DIGS specified? Then use default.*/
Line 85:
numeric digits; parse value format(x,2,1,,0) 'E0' with g 'E' _ .; g=g *.5'e'_ % 2
do j=0 while h>9; m.j=h; h=h % 2 + 1; end /*j*/
do k=j+5 to 0 by -1; numeric digits m.k; g=(g+x/g)*.5; end /*k*/; return g</
{{out|output|text= (from multiple runs) with a specified number of digits, and with the various outputs being combined/reduced/edited:}}
<pre>
|