Create a gist now

Instantly share code, notes, and snippets.

import numpy
from matplotlib import pyplot
import seaborn
p = numpy.logspace(-6, 0, 50)
pyplot.figure(figsize=(10, 5))
for k in [1, 3, 10, 30, 100, 300, 1000]:
Z = (p * k**2 + (1 - p)) / (p * k + (1 - p))
pyplot.plot(p, Z, label='Delay factor %d for train problem' % k)
pyplot.xscale('log')
pyplot.yscale('log')
pyplot.title('Average time you have to wait given that train problems with some probability and magnitude')
pyplot.xlabel('Probability of train problem')
pyplot.ylabel('Average time you have to wait compared to baseline')
pyplot.legend(loc=2)
pyplot.savefig('train_problems.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment