The arithmetic-geometric mean agm(a, b) of two numbers a and b (often also written AGM(a, b) or M(a, b)) is defined by starting with a_0 congruent a and b_0 congruent b, then iterating a_(n + 1) | = | 1/2(a_n + b_n) b_(n + 1) | = | sqrt(a_n b_n) until a_n = b_n to the desired precision. a_n and b_n converge towards each other since a_(n + 1) - b_(n + 1) | = | 1/2(a_n + b_n) - sqrt(a_n b_n) | = | (a_n - 2sqrt(a_n b_n) + b_n)/2.