StandardDeviationFunction extends MultiaryFunction { public Double evaluate(Collection<?> values, boolean biasCorrected){ StandardDeviation statistic = new StandardDeviation(); statistic.setBiasCorrected(biasCorrected); for(Object value : values){ Number number = (Number)TypeUtil.parseOrCast(DataType.DOUBLE, value); statistic.increment(number.doubleValue()); } return statistic.getResult(); } StandardDeviationFunction();  StandardDeviationFunction(String name); Double evaluate(Collection<?> values, boolean biasCorrected); @Override FieldValue evaluate(List<FieldValue> arguments);  }
@Test public void evaluate(){ List<Double> values = Arrays.asList(2d, 4d, 4d, 4d, 5d, 5d, 7d, 9d); assertEquals(Math.sqrt(32d / 8d), (Double)evaluate(values), 1e-8); assertEquals(Math.sqrt(32d / 7d), (Double)evaluate(values, true), 1e-8); assertEquals(Math.sqrt(32d / 8d), (Double)evaluate(values, false), 1e-8); }