This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: return minnum, maxnum, avg, sd #returns a tuple with all the values #Then assign by lowest,highest,average,sd=stats(range(0,20)) #Test with a gaussian distributed random sequence: random.gauss(mean,sd) def randseq(mean,sd,number,type='g'): import random seq= if type=='g': for i in range(number): seq.append(random.gauss(mean,sd)) elif type=='u': for i in range(number): seq.append(random.uniform(mean,sd)) else: print "The type of distribution is 'g' for gaussian (default) or 'u' for uniform" return return seq randlst=randseq(50,3,1000) stddev(randlst) #should be about 3 #pylab has a histogram function from pylab import * hist(randlst)...
View Full Document
This note was uploaded on 10/05/2010 for the course PHYS phy503 taught by Professor Gladden during the Spring '09 term at Ole Miss.
- Spring '09