Algorithms for the arithmetic-geometric mean¶
With complex variables, it is convenient to work with the univariate
function
Functional equation¶
If the real part of z initially is not completely nonnegative, we
apply the functional equation
Note that u has nonnegative real part, absent rounding error. It is not a problem for correctness if rounding makes the interval contain negative points, as this just inflates the final result.
For the derivative, the functional equation becomes
AGM iteration¶
Once z is in the right half plane, we can apply the AGM iteration
(
The iteration should be terminated when
Rather than running the AGM iteration until
valid at least when
where the tail is bounded by
First derivative¶
Assuming that z is exact and that
The basic inequality we need is
By Cauchy’s integral formula,
assuming that h is chosen so that it satisfies
The forward finite difference would require two function evaluations at doubled precision. We use the central difference as it only requires 1.5 times the precision.
When z is not exact, we evaluate at the midpoint as above and bound the propagated error using derivatives. Again by Cauchy’s integral formula, we have
assuming that the circle centered on z with radius
Higher derivatives¶
The function
in general, and
when