Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168755
Image: ubuntu2004
import numpy import pylab # number of customers n = 10000 # average time between arrivals a = 1 # average time to serve each customer b = 1 # Generate samples: # inter-arrival times at=numpy.random.exponential(a,n) st=numpy.random.exponential(b,n) for i in range(n-1): at[i+1]=at[i+1]+at[i] ft=range(n) ft[0]=at[0]+st[0] for i in range(n-1): ft[i+1]=max(at[i+1]+st[i+1],ft[i]+st[i+1])
pylab.clf() pylab.hist(ft-at) pylab.savefig('sage.png')