/* Chi dist (generating samples) in Picat. From Handbook on probability distributions page 77ff See ppl_distributions.pi for the definitions of PDF, CDF, and quantile, and ppl_distributions_test.pi for tests of these. Cf my Gamble model gamble_chi_dist.rkt This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import ppl_distributions, ppl_utils. import util. % import ordset. main => go. /* var : g Probabilities (truncated): 4.87092964949741: 0.0001000000000000 4.253810460859521: 0.0001000000000000 4.067932844874163: 0.0001000000000000 4.020446960939659: 0.0001000000000000 ......... 0.020199275520739: 0.0001000000000000 0.018373645714474: 0.0001000000000000 0.008625360767505: 0.0001000000000000 0.002433029924934: 0.0001000000000000 mean = 1.24948 var : mean theoretical Probabilities: 1.25331: 1.0000000000000000 mean = 1.25331 */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => K = 2, G = chi_dist(K), Mean = chi_dist_mean(K), add("g",G), add("mean theoretical",Mean).