Created
September 10, 2018 20:07
-
-
Save yostane/6ca193723bee06c21dc30e9ef35daafc to your computer and use it in GitHub Desktop.
Exercice 2.4 sur les files d'attente
This file contains hidden or 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
| # coding=utf-8 | |
| import math | |
| import decimal | |
| def B(s, a): | |
| denom = 0 | |
| for i in range(0, s+1): | |
| denom += float(decimal.Decimal(pow(a, i)) / | |
| decimal.Decimal(math.factorial(i))) | |
| numerateur = float(decimal.Decimal(pow(a, s)) / | |
| decimal.Decimal(math.factorial(s))) | |
| resultat = numerateur / denom | |
| return resultat | |
| def estimaerN(a, seuil): | |
| N = 0 | |
| while True: | |
| N += 1 | |
| Fn = B(N, a) | |
| if Fn <= seuil: | |
| break | |
| return N | |
| N = estimaerN(6.0, 0.01) | |
| print("le nombre de personnes pour que la proba qu'elles soient toutes occupées est <= 0.01 est", N) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment