Created
July 7, 2016 02:23
-
-
Save erikbern/a9dfef6ff1834ccfac8dc58a9d80d019 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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