arithmetic mean of a function