math元件用法例項

2021-04-14 08:56:26 字數 3224 閱讀 4613

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 ;

/** 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(); // 算術平均值

product product = new product();

sum 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(); // 百分位數

geometricmean geomean = new geometricmean(); // 幾何平均數,n個正數的連乘積的n次算術根叫做這n個數的幾何平均數

skewness skewness = new skewness(); // skewness();

kurtosis kurtosis = new kurtosis(); // kurtosis,峰度

sumofsquares sumofsquares = new sumofsquares(); // 平方和

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

// 就是標準方差

system.out.println("standarddeviation: "

+ standarddeviation.evaluate(values));}}

Math物件的用法

math物件在js中常常處理一些數學數值的問題 math物件並不像date和string那樣是物件的類,因此沒有建構函式math 像math.abs 這樣的函式只是函式,不是某個物件的方法。因此,我們不需要建立它,可以直接把它作為物件直接使用就可以呼叫它的所有屬性和方法。對於負數取正處理,取絕對值 ...

Yii框架響應元件用法例項分析

當我們的瀏覽器傳送過來乙個請求之後,在我們的操作裡面對請求經過處理之後,我們的伺服器也會把請求的結果打包成乙個訊息,然後把這個訊息返還程式設計客棧給瀏覽器,這個訊息我們稱之為響應。在我們的操作中,我們也可以對響應進行一些設定和處理。要處理我們的響應,我們程式設計客棧需要先獲得響應元件這個東西。res...

Math的用法!! 學的較淺

小數值捨入為整數的幾個方法 1.math.ceil 執行向上捨入,即它總是將數值向上捨入為最接近的整數 2.math.floor 執行向下捨入,即它總是將數值向下捨入為最接近的整數 3.math.round 執行標準捨入,即它總是將數值四捨五入為最接近的整數 1 2 3 4 5 6 7 8 9 al...