{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lab12 - while q1<= qtotal for each possible value of...

This preview shows page 1. Sign up to view the full content.

from __future__ import division from visual.factorial import * from visual.graph import * waygraph = gvbars(delta=0.7, color=color.red) # to make vertical bar graph Ntotal = 500 # total number of oscillators N1 = 300 # number of oscillators in object 1 N2 = Ntotal-N1 # number of oscillators in object 2 qtotal = 100 # total quanta of energy shared among all the oscillators q1 = 0 # start with no quanta of energy in object 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: while q1 <= qtotal: # for each possible value of energy in object 1 q2 = qtotal-q1 # number of quanta of energy in object 2 # Calculate number of ways to arrange q1 quanta in object 1: ways1 =combin(q1+N1-1,q1) # Calculate number of ways to arrange q2 quanta in object 2: ways2 =combin(q2+N2-1,q2) # Plot number of ways to arrange energy in the two objects: waygraph.plot( pos=(q1,ways1*ways2) ) q1 = q1+1...
View Full Document

{[ snackBarMessage ]}