Math component usage example

Source: Internet
Author: User

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 = new min ();
Max max = new max ();
Mean mean = new mean (); // arithmetic mean value
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
Geometricmean geomean = new geometricmean (); // geometric mean. the n-th arithmetic root of the product of n positive numbers is the geometric mean of N numbers.
Skewness skewness = new skewness (); // skewness ();
Kurtosis = new kurtosis (); // kurtosis, kurtosis
Sumofsquares = new sumofsquares (); // sum of squares
Standarddeviation = new standarddeviation ();
System. Out. println ("80 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 ));
// Standard variance
System. Out. println ("standarddeviation :"
+ Standarddeviation. Evaluate (values ));
}
}
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.