comparison ch5ex6.py @ 34:66a5e7f7c10f

Added a check to see if we were calculating the probabilities correctly.
author Brian Neal <bgneal@gmail.com>
date Wed, 09 Jan 2013 20:19:49 -0600
parents a13c00c0dfe5
children 10db8c3a6b83
comparison
equal deleted inserted replaced
33:cfb7f28678c7 34:66a5e7f7c10f
125 125
126 vals = p.items() 126 vals = p.items()
127 vals.sort(key=lambda t: t[0]) 127 vals.sort(key=lambda t: t[0])
128 x, y = zip(*vals) 128 x, y = zip(*vals)
129 129
130 assert abs(sum(y) - 1.0) < 1e-6
131
130 pyplot.clf() 132 pyplot.clf()
131 pyplot.xscale('log') 133 pyplot.xscale('log')
132 pyplot.yscale('log') 134 pyplot.yscale('log')
133 pyplot.title('P(k) versus k') 135 pyplot.title('P(k) versus k')
134 pyplot.xlabel('k') 136 pyplot.xlabel('k')