/* Histogram test in Picat. Cf my Gamble model gamble_histogram_test.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 : x Probabilities (truncated): 103: 0.0402000000000000 99: 0.0402000000000000 100: 0.0401000000000000 98: 0.0397000000000000 ......... 133: 0.0001000000000000 66: 0.0001000000000000 62: 0.0001000000000000 61: 0.0001000000000000 mean = 99.854 Histogram (total 10000) 61.000: 2 (0.000 / 0.000) 63.100: 0 (0.000 / 0.000) 65.200: 3 (0.000 / 0.001) 67.300: 8 (0.001 / 0.001) 69.400: 11 # (0.001 / 0.002) 71.500: 20 # (0.002 / 0.004) 73.600: 19 # (0.002 / 0.006) 75.700: 39 ## (0.004 / 0.010) 77.800: 59 ### (0.006 / 0.016) 79.900: 107 ###### (0.011 / 0.027) 82.000: 252 ############## (0.025 / 0.052) 84.100: 229 ############ (0.023 / 0.075) 86.200: 333 ################## (0.033 / 0.108) 88.300: 434 ####################### (0.043 / 0.152) 90.400: 515 ############################ (0.051 / 0.203) 92.500: 609 ################################# (0.061 / 0.264) 94.600: 662 ################################### (0.066 / 0.330) 96.700: 769 ######################################### (0.077 / 0.407) 98.800: 799 ########################################### (0.080 / 0.487) 100.900: 793 ########################################### (0.079 / 0.566) 103.000: 1119 ############################################################ (0.112 / 0.678) 105.100: 714 ###################################### (0.071 / 0.750) 107.200: 611 ################################# (0.061 / 0.811) 109.300: 480 ########################## (0.048 / 0.859) 111.400: 373 #################### (0.037 / 0.896) 113.500: 297 ################ (0.030 / 0.926) 115.600: 239 ############# (0.024 / 0.950) 117.700: 175 ######### (0.018 / 0.967) 119.800: 125 ####### (0.013 / 0.980) 121.900: 73 #### (0.007 / 0.987) 124.000: 68 #### (0.007 / 0.994) 126.100: 24 # (0.002 / 0.996) 128.200: 15 # (0.002 / 0.998) 130.300: 14 # (0.001 / 0.999) 132.400: 3 (0.000 / 0.999) 134.500: 1 (0.000 / 0.999) 136.600: 2 (0.000 / 1.000) 138.700: 2 (0.000 / 1.000) 140.800: 1 (0.000 / 1.000) 142.900: 1 (0.000 / 1.000) var : y Probabilities (truncated): 0.342672904867837: 0.0001000000000000 0.33661339683252: 0.0001000000000000 0.327506274735318: 0.0001000000000000 0.327077336465257: 0.0001000000000000 ......... -0.34283190005491: 0.0001000000000000 -0.34675441506371: 0.0001000000000000 -0.361143477885092: 0.0001000000000000 -0.40572591440135: 0.0001000000000000 mean = 0.00182904 Histogram (total 10000) -0.406: 1 (0.000 / 0.000) -0.387: 0 (0.000 / 0.000) -0.368: 1 (0.000 / 0.000) -0.350: 2 (0.000 / 0.000) -0.331: 6 (0.001 / 0.001) -0.312: 4 (0.000 / 0.001) -0.293: 8 # (0.001 / 0.002) -0.275: 16 # (0.002 / 0.004) -0.256: 20 ## (0.002 / 0.006) -0.237: 52 #### (0.005 / 0.011) -0.219: 71 ###### (0.007 / 0.018) -0.200: 95 ####### (0.009 / 0.028) -0.181: 150 ############ (0.015 / 0.043) -0.162: 206 ################ (0.021 / 0.063) -0.144: 280 ###################### (0.028 / 0.091) -0.125: 318 ######################### (0.032 / 0.123) -0.106: 417 ################################# (0.042 / 0.165) -0.088: 488 ###################################### (0.049 / 0.214) -0.069: 571 ############################################# (0.057 / 0.271) -0.050: 670 #################################################### (0.067 / 0.338) -0.032: 695 ###################################################### (0.070 / 0.407) -0.013: 706 ####################################################### (0.071 / 0.478) 0.006: 766 ############################################################ (0.077 / 0.554) 0.025: 691 ###################################################### (0.069 / 0.623) 0.043: 706 ####################################################### (0.071 / 0.694) 0.062: 610 ################################################ (0.061 / 0.755) 0.081: 535 ########################################## (0.053 / 0.808) 0.099: 475 ##################################### (0.048 / 0.856) 0.118: 371 ############################# (0.037 / 0.893) 0.137: 306 ######################## (0.031 / 0.924) 0.156: 223 ################# (0.022 / 0.946) 0.174: 174 ############## (0.017 / 0.963) 0.193: 139 ########### (0.014 / 0.977) 0.212: 87 ####### (0.009 / 0.986) 0.230: 53 #### (0.005 / 0.991) 0.249: 38 ### (0.004 / 0.995) 0.268: 17 # (0.002 / 0.997) 0.287: 15 # (0.002 / 0.998) 0.305: 8 # (0.001 / 0.999) 0.324: 9 # (0.001 / 1.000) */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean,show_histogram]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => X = poisson_dist(100), Y = normal_dist(0,0.1), add("x",X), add("y",Y).