# HG changeset patch # User Henry S. Thompson # Date 1627491292 -3600 # Node ID bb46148fab910a7dfa574e77ef7b0e0ba154e7e4 # Parent 6c389c0f1b40be701310b38aa7fcd0df0ec5923f second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment diff -r 6c389c0f1b40 -r bb46148fab91 distr_2.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distr_2.py Wed Jul 28 17:54:52 2021 +0100 @@ -0,0 +1,15 @@ +# experimenting with distributions +# Usage: distr.py N bucketWidth max +import sys, random, signif +from nltk import FreqDist + +mu=float(sys.argv[1]) +sigma=float(sys.argv[2]) +n=int(sys.argv[3]) +scale=float(sys.argv[4]) +fd=FreqDist() +fd2=FreqDist() +for i in xrange(n): + fd[round(random.normalvariate(mu,sigma)/scale)]+=1 + fd2[round(random.gauss(mu,sigma)/scale)]+=1 +fd.bell(xtra=fd2)