/* Are under normal curve in Picat. From http://www.statistics101.net/statistics101web_000007.htm """ From CliffsQuickReview Statistics, p. 56, example 2 A normal distribution of retail store purchases has a mean of $14.31 and a standard deviation of 6.40. What percentage of purchases were under $10? """ Exact value is: Picat> X=normal_dist_cdf(14.31,6.40,10) X = 0.250334499087507 Cf my Gamble model gamble_area_under_normal_curve.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. main => go. /* var : d Probabilities (truncated): 39.185020727011505: 0.0001000000000000 36.824144282241015: 0.0001000000000000 36.638245205507623: 0.0001000000000000 36.582206201483082: 0.0001000000000000 ......... -7.689877147364927: 0.0001000000000000 -8.074843170614232: 0.0001000000000000 -9.534611677397267: 0.0001000000000000 -11.744059531790414: 0.0001000000000000 mean = 14.2791 var : p Probabilities: false: 0.7472000000000000 true: 0.2528000000000000 mean = [false = 0.7472,true = 0.2528] */ go ?=> reset_store, run_model(10_000,$model,[show_probs_trunc,mean]), nl, % show_store_lengths,nl, % fail, nl. go => true. model() => D = normal_dist(14.31,6.40), P = check(D < 10), add("d",D), add("p",P).