src/main/java/eu/digitisation/math/Arrays.java
public static double cov(double[] X, double[] Y) {
        int len = Math.min(X.length, Y.length);
        double sum = 0;

        for (int n = 0; n < len; ++n) {
            sum += X[n] * Y[n];
        }
        return sum / len - average(X) * average(Y);
    }
/**
     * Covariance of two variables
     *
     * @param X array of double
     * @param Y another array of double
     * @return Covariance of X and Y
     */
Covariance of two variables
@param X array of double
@param Y another array of double
@return Covariance of X and Y
Covariance of two variables @param X array of double @param Y another array of double @return Covariance of X and Y
public static double cov(double[] X, double[] Y) {
        int len = Math.min(X.length, Y.length);
        double sum = 0;
        for (int n = 0; n < len; ++n) {
            sum += X[n] * Y[n];
        }
        return sum / len - average(X) * average(Y);
    }
public static double cov ( double [ ] X , double [ ] Y ) { int len = Math . min ( X . length , Y . length ) ; double sum = 0 ; for ( int n = 0 ; n < len ; ++ n ) { sum += X [ n ] * Y [ n ] ; } return sum / len - average ( X ) * average ( Y ) ; }
Covariance of two variables
 @param X array of double
 @param Y another array of double
 @return Covariance of X and Y
Covariance of two variables @param X array of double @param Y another array of double @return Covariance of X and Y