from visual.graph import * from visual.factorial import * # Problem 11.P.38a Probability distribution Ntotal = 6 # total number of oscillators N1 = 3 # number of oscillators in first object N2 = XXXXXX # number of oscillators in second object qtotal = 4 # total quanta of energy shared among all oscillators waygraph = gvbars(color=color.red, delta=0.7) # makes a vertical bar graph q1 = 0 #start with no quanta in the first object while q1 <= qtotal: # for each possible value of energy in object 1 q2 = XXXXXX # number of quanta in object 2 ways1 = combin(q1+N1-1,q1) # number of ways to arrange q1 quanta in object 1 ways2 = XXXXXX # number of ways to arrange q2 quanta in object 2 ways = XXXXXX # total number of ways to arrange energy in both objects waygraph.plot(pos=(q1,ways)) print q1, ways1, ways2, ways q1 = q1 + 1