In the arithmetic-geometric mean, we combine the arithmetic mean and the geometric mean like so, $$a_0=a,~b_0=b$$ $$a_1=\frac{a_0+b_0}{2},~b_1=\sqrt{a_0 b_0}$$ $$\vdots$$ $$a_{n+1}=\frac{a_n+b_n}{2},~b_{n+1}=\sqrt{a_n b_n}$$ $$AGM(a, b)=\lim_{n\to\infty} a_n=\lim_{n\to\infty} b_n$$ I would like to have a more general purpose function, something like
ComboMean[f,g,x]
gives the a similar kind of mean, but instead of combining the arithmetic mean and the geometric mean, we combine any two functions f and g using a similar iteration.
But I'm stumped on the syntax on how to accomplish this. Right now, I'm writing a specific function for each mean I'm trying to find.
For example:
f2[x_] := {Mean[x], Total[x^2]/Total[x]}
M2[x_] := Nest[f2, x, 10][[1]] // N
NestList[{Mean[#], GeometricMean[#]} &, {2., 3.}, 40]
$\endgroup$ArithmeticGeometricMean
in the Wolfram Language. $\endgroup$