Skip to content

subtractFromMean

subtractFromMean(mean, n, value): number

Defined in: src/subtract_from_mean.js:16

When removing a value from a list, one does not have to necessary recompute the mean of the list in linear time. They can instead use this function to compute the new mean by providing the current mean, the number of elements in the list that produced it and the value to remove.

number

current mean

number

number of items in the list

number

the value to remove

number

the new mean

3.0.0

subtractFromMean(20.5, 6, 53); // => 14