计算双精度数组的方差。
//package com.nowjava; /** 来 自 nowjava.com - 时 代 Java **/ public class Main { /** * Compute the variance of the timeseries. * * @param series The input timeseries. * @return the variance of values. */ public static double var(double[] series) { double res = 0D; double mean = mean(series); for (int i = 0; i < series.length; i++) { res += (series[i] - mean) * (series[i] - mean); } return res / ((Integer) (series.length - 1)).doubleValue(); }/** 时 代 J a v a 公 众 号 提 供 **/ /** * Compute the mean of the timeseries. * * @param series The input timeseries. * @return the mean of values. */ public static double mean(double[] series) { double res = 0D;