Apache's math component, although not commonly used, I also sorted it out today.
Download Address: http://commons.apache.org/math/
Sample code:
Package demo;
import Org.apache.commons.math.stat.descriptive.moment.GeometricMean;
import org.apache.commons.math.stat.descriptive.moment.Kurtosis;
import Org.apache.commons.math.stat.descriptive.moment.Mean;
import org.apache.commons.math.stat.descriptive.moment.Skewness;
import org.apache.commons.math.stat.descriptive.moment.StandardDeviation;
import org.apache.commons.math.stat.descriptive.moment.Variance;
import Org.apache.commons.math.stat.descriptive.rank.Max;
import Org.apache.commons.math.stat.descriptive.rank.Min;
import Org.apache.commons.math.stat.descriptive.rank.Percentile;
import org.apache.commons.math.stat.descriptive.summary.Product;
Import Org.apache.commons.math.stat.descriptive.summary.Sum;
import Org.apache.commons.math.stat.descriptive.summary.SumOfSquares;
public class Testmathuserage ... {
public static void Main (string[] args) ... {
double[] values = new double[] ... {0.33, 1.33, 0.27333, 0.3, 0.501,
0.444, 0.44, 0.34496, 0.33, 0.3, 0.292, 0.667};
/**//*
* SYSTEM.OUT.PRINTLN ("min:" + statutils.min (values));
* SYSTEM.OUT.PRINTLN ("max:" + Statutils.max (values));
* SYSTEM.OUT.PRINTLN ("mean:" + statutils.mean (values)); Returns
* The arithmetic mean of the entries in the input array, or Double.NaN
* If the array is empty SYSTEM.OUT.PRINTLN ("Product:" +
* STATUTILS.PRODUCT (values)); Returns the product of the entries
* In the input array, or Double.NaN if the array is empty.
* SYSTEM.OUT.PRINTLN ("sum:" + statutils.sum (values)); Returns
* The sum of the values in the input array, or Double.NaN if the array
* is empty. System.out.println ("Variance:" + statutils.variance (
* values)); Returns the variance of the entries in the input
* Array, or Double.NaN if the array is empty.
*/
min min = new min ();
Max max = new Max ();
Mean Mean = new Mean (); Arithmetic mean value
Product Product = new product ();
sum = new sum ();
Variance Variance = new variance ();
System.out.println ("min:" + min.evaluate (values));
System.out.println ("Max:" + max.evaluate (values));
System.out.println ("mean:" + mean.evaluate (values));
System.out.println ("Product:" + product.evaluate (values));
System.out.println ("sum:" + sum.evaluate (values));
System.out.println ("variance:" + variance.evaluate (values));
percentile percentile = new percentile (); Percentile digit
Geometricmean Geomean = new Geometricmean (); The geometric mean, n-th arithmetic roots of the continuous product of n-positive numbers is called the geometric mean of the number of n
skewness skewness = new skewness (); Skewness ();
kurtosis kurtosis = new Kurtosis (); Kurtosis, Kurtosis
sumofsquares sumofsquares = new Sumofsquares (); Square and
standarddeviation standarddeviation = new Standarddeviation ();
System.out.println ("Percentile value:"
+ percentile.evaluate (values, 80.0));
System.out.println ("Geometric mean:" + geomean.evaluate (values));
System.out.println ("skewness:" + skewness.evaluate (values));
System.out.println ("kurtosis:" + kurtosis.evaluate (values));
System.out.println ("sumofsquares:" + sumofsquares.evaluate (values));
//is the standard variance
System.out.println ("Standarddeviation:"
+ standarddeviation.evaluate (values));
}
}