/* Cauchy dist (generating random samples) in Picat. From Handbook on probability distributions page 86ff. 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_cauchy-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 : g1 Probabilities (truncated): 20.446045442976306: 0.0001000000000000 19.942374178810528: 0.0001000000000000 17.923284197818901: 0.0001000000000000 16.286526722561781: 0.0001000000000000 ......... 0.0003532199238: 0.0001000000000000 0.000349741314932: 0.0001000000000000 0.000227678386393: 0.0001000000000000 0.000094148929307: 0.0001000000000000 mean = 2.00706 var : g2 Probabilities (truncated): 23.339520321936742: 0.0001000000000000 20.958626737041364: 0.0001000000000000 17.608084603391141: 0.0001000000000000 16.159683316342413: 0.0001000000000000 ......... 0.000856518900832: 0.0001000000000000 0.000181118569708: 0.0001000000000000 0.000158708870351: 0.0001000000000000 0.000079441829743: 0.0001000000000000 mean = 2.02696 var : mean (theoretical) Probabilities: 2: 1.0000000000000000 mean = 2.0 */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => Delta = 1, Gamma = 2, G1 = gamma_dist(Delta,Gamma), G2 = gamma_dist(Delta,Gamma), Mean = gamma_dist_mean(Delta,Gamma), add("g1",G1), add("g2",G2), add("mean (theoretical)",Mean).