I would like to compute \int_a^b(f-\bar{f})^ndx where \bar{f}=\int_a^bf dx. Is it possible to compute it in one pass?

# Computation of function moments

**aaowens**#2

Wikipedia gives code for a Welford algorithm to do this here https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm , at least for the variance.