public static double variance ( int [ ] histogram , double mean , int counts , int N ) { double sum = 0.0 ; for ( int i = 0 ; i < N ; i ++ ) { double d = i - mean ; sum += ( d * d ) * histogram [ i ] ; } return sum / counts ; }
Computes the variance of elements in the histogram