weightedAverage function

double weightedAverage(
  1. List<num> vals
)

weighted average of values

Implementation

double weightedAverage(List<num> vals) {
  double acc = 0;
  for (int i = 0; i < vals.length; i++) {
    acc += vals[i] * (i + 1);
  }
  return acc / smallGauss(vals.length);
}