Java Geometric Mean geometricMean(double... values)

Here you can find the source of geometricMean(double... values)

Description

geometric Mean

License

Apache License

Declaration

public static double geometricMean(double... values) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static double geometricMean(double... values) {
        return Math.pow(product(values), 1. / values.length);
    }/*from   w w w  . j a va 2  s.  c om*/

    public static double product(double... values) {
        double sum = 1;
        for (double v : values) {
            sum *= v;
        }
        return sum;
    }
}

Related

  1. geometricMean(double a, double b)
  2. geometricMean(double[] nums)
  3. geometricMean(double[] values)
  4. geometricMean(final double[] values)
  5. geometricMean(float[] xs)