Maths Algorithms in C#: The Arithmetic Mean
The arithmetic mean is defined as the average of a set of data. It is found by taking the sum of each value in the data set, and then dividing by the total number of data points.
The full sourcecode for the MathLib library is available at https://github.com/sjmeunier/mathlib
Originally posted on my old blog, Smoky Cogs, on 23 Oct 2009
Updated 5 Oct 2016: Updated code snippet after refactoring MathLib library