/* Chi squared inverse dist (generating samples) in Picat. From Handbook on probability distributions page 81ff Note: The ppl_distributions.pi does not support PDF, CDF, quantile for this, just random distribution. Cf my Gamble model gamble_chi_squared_inverse_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): 39.9905357492975: 0.0001000000000000 35.668839401379749: 0.0001000000000000 24.404015137718847: 0.0001000000000000 22.294754910270829: 0.0001000000000000 ......... 0.048769054466211: 0.0001000000000000 0.046681465700159: 0.0001000000000000 0.045483041021476: 0.0001000000000000 0.042006457191742: 0.0001000000000000 mean = 0.496719 */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => K = 4, G = chi_square_inverse_dist(K), add("g",G).