x <- 1:3
y <- 4:6
w <- 3:1
# Factor the arithmetic mean by chaining the calculation.
gmean(x * y, w)
gmean(x, w) * gmean(y, update_weights(x, w))
# In cases where x and y have the same order, Chebyshev's
# inequality implies that the chained calculation is too small.
gmean(x * y, w) > gmean(x, w) * gmean(y, w)
Run the code above in your browser using DataLab