comparison distr_2.py @ 28:bb46148fab91

second half of old /c/Drive_F/merged_d/src/python/distr.py, modified to do coin flip experiment
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 28 Jul 2021 17:54:52 +0100
parents
children
comparison
equal deleted inserted replaced
27:6c389c0f1b40 28:bb46148fab91
1 # experimenting with distributions
2 # Usage: distr.py N bucketWidth max
3 import sys, random, signif
4 from nltk import FreqDist
5
6 mu=float(sys.argv[1])
7 sigma=float(sys.argv[2])
8 n=int(sys.argv[3])
9 scale=float(sys.argv[4])
10 fd=FreqDist()
11 fd2=FreqDist()
12 for i in xrange(n):
13 fd[round(random.normalvariate(mu,sigma)/scale)]+=1
14 fd2[round(random.gauss(mu,sigma)/scale)]+=1
15 fd.bell(xtra=fd2)