Then iterate this operation with a1 taking the place of x and g1 taking the place of y. In this way, two sequences (an) and (gn) are defined:
These two sequences converge to the same number, which is the arithmetic-geometric mean of x and y; it is denoted by M(x, y), or sometimes by agm(x, y).
and then iterate as follows:
The first four iterations give the following values:
The arithmetic-geometric mean of 24 and 6 is the common limit of these two sequences, which is approximately 13.45817148173.
If r > 0, then M(rx, ry) = r M(x, y).
There is a closed form expression for M(x,y):
where K(x) is the complete elliptic integral of the first kind.
named after Carl Friedrich Gauss.
The geometric-harmonic mean can be calculated by an analogous method, using sequences of geometric and harmonic means. The arithmetic-harmonic mean can be similarly defined, but takes the same value as the geometric mean.
from math import sqrt
def avg(a, b, delta=None):if None==delta:delta=(a+b)/2*1E-10if(abs(b-a)>delta):return avg((a+b)/2.0, sqrt(a*b), delta)else:return (a+b)/2.0
A Note on Utilizing the Geometric Mean: When, Why and How the Forensic Economist Should Employ the Geometric Mean
Aug 01, 2008; Abstract Forensic Economists often utilize the arithmetic average for calculating growth rates to estimate economic damages....
Effect of Different Dietary Geometric Mean Particle Length and Particle Size Distribution of Oat Silage on Feeding Behavior and Productive Performance of Dairy Cattle
Feb 01, 2005; ABSTRACT Twenty lactating Holstein cows (5 primiparous and 15 multiparous) were used in a 5 × 5 Latin Square design, with 5...