{{wikipedia|Arithmetic-geometric mean}}


;task:

Write a function to compute the [[wp:Arithmetic-geometric mean|arithmetic-geometric mean]] of two numbers.
[http://mathworld.wolfram.com/Arithmetic-GeometricMean.html]
The arithmetic-geometric mean of two numbers can be (usefully) denoted as <math>\mathrm{agm}(a,g)</math>, and is equal to the limit of the sequence:
: <math>a_0 = a; \qquad g_0 = g</math>
: <math>a_{n+1} = \tfrac{1}{2}(a_n + g_n); \quad g_{n+1} = \sqrt{a_n g_n}.</math>
Since the limit of <math>a_n-g_n</math> tends (rapidly) to zero with iterations, this is an efficient method.

Demonstrate the function by calculating:
:<math>\mathrm{agm}(1,1/\sqrt{2})</math>


;Also see:
* &nbsp; [http://mathworld.wolfram.com/Arithmetic-GeometricMean.html mathworld.wolfram.com/Arithmetic-Geometric Mean]
<br><br>
