cern.jet.random.tdouble

Package cern.jet.random.tdouble

Large variety of probability distributions featuring high performance generation of random numbers, CDF's and PDF's.

See: Description

Package cern.jet.random.tdouble Description

Large variety of probability distributions featuring high performance generation of random numbers, CDF's and PDF's.You can always do a quick and dirty check to test the properties of any given distribution, for example, as follows:

// Gamma distribution// define distribution parametersdouble mean = 5;double variance = 1.5;double alpha = mean*mean / variance; double lambda = 1 / (variance / mean); // for tests and debugging use a random engine with CONSTANT seed --> deterministic and reproducible resultscern.jet.random.engine.RandomEngine engine = new cern.jet.random.engine.MersenneTwister(); // your favourite distribution goes herecern.jet.random.AbstractDistribution dist = new cern.jet.random.Gamma(alpha,lambda,engine);// collect random numbers and print statisticsint size = 100000;cern.colt.list.tdouble.DoubleArrayList numbers = new cern.colt.list.tdouble.DoubleArrayList(size);for (int i=0; i < size; i++) numbers.add(dist.nextDouble());hep.aida.bin.DynamicBin1D bin = new hep.aida.bin.DynamicBin1D();bin.addAllOf(numbers);System.out.println(bin);Will print something likeSize: 100000Sum: 499830.30147620925SumOfSquares: 2648064.0189520954Min: 1.2903021480010035Max: 12.632626684290546Mean: 4.998303014762093RMS: 5.14593433591228Variance: 1.497622138362513Standard deviation: 1.2237737284165373Standard error: 0.0038699123224725817Geometric mean: 4.849381516061957Product: InfinityHarmonic mean: 4.69916104903662Sum of inversions: 21280.394299425236Skew: 0.49097523334186227Kurtosis: 0.3461005384481113Sum of powers(3): 1.4822908764628284E7Sum of powers(4): 8.741360251658581E7Sum of powers(5): 5.41658186456702E8Sum of powers(6): 3.5183920126086535E9Moment(0,0): 1.0Moment(1,0): 4.998303014762093Moment(2,0): 26.480640189520955Moment(3,0): 148.22908764628284Moment(4,0): 874.1360251658581Moment(5,0): 5416.58186456702Moment(6,0): 35183.92012608654Moment(0,mean()): 1.0Moment(1,mean()): 3.7017002796346785E-14Moment(2,mean()): 1.4976071621409774Moment(3,mean()): 0.8998351672510565Moment(4,mean()): 7.50487543880015Moment(5,mean()): 14.413483695698101Moment(6,mean()): 77.7211932558671525%, 50%, 75% Quantiles: 4.122365795016783, 4.897730017566362, 5.763097174551738quantileInverse(median): 0.500005Distinct elements & frequencies not printed (too many).

SCaVis 2.0 © jWork.ORG