Jakarta-common-math Use Notes

Source: Internet
Author: User
Tags arithmetic empty min

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));


   }


}

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.