anosem/assigns.py

35 lines
586 B
Python
Raw Normal View History

2021-10-11 17:34:41 +02:00
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(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()