prosem/assigns.py

36 lines
605 B
Python

from plt2 import *
import numpy as np
#probability that one thesis is not going to be picket
students=15
topics=15
def by_picks(picks=3):
return (1-(((topics-picks)/topics)**students))**topics
print(by_picks(1))
#print(by_picks(1))
#print(by_picks(2))
#print(by_picks(3))
picks=np.arange(1.0,5.0,0.1)
probs=[by_picks(pick) for pick in picks]
plt.plot(picks,probs)
plt.title("Probability of everybody being assigned a favorable topic")
plt.ylabel("Probability")
plt.xlabel("Average number of favored topics")
plt.savefig("assigns.png")
plt.savefig("assigns.pdf",format="pdf")
plt.show()