Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
teaching:exos:paradoxe_anniversaires [2012/10/22 13:27] – créée villersd | teaching:exos:paradoxe_anniversaires [2020/07/14 13:06] (Version actuelle) – villersd | ||
---|---|---|---|
Ligne 16: | Ligne 16: | ||
===== Programme Python ===== | ===== Programme Python ===== | ||
- | <sxh python;> | + | <code python |
# | # | ||
# -*- coding: UTF-8 -*- | # -*- coding: UTF-8 -*- | ||
Ligne 32: | Ligne 32: | ||
# nombre de possibilités différentes | # nombre de possibilités différentes | ||
# (= nombre de jours d'une année dans les exemples) | # (= nombre de jours d'une année dans les exemples) | ||
- | poss=365 | + | poss = 365 |
# nombre d' | # nombre d' | ||
- | n=40 | + | n = 40 |
# solution : p = poss ! / ( (poss-n) ! * poss^n) | # solution : p = poss ! / ( (poss-n) ! * poss^n) | ||
- | pcomp=1. | + | pcomp = 1. |
for i in range(poss, poss-n, -1): | for i in range(poss, poss-n, -1): | ||
- | pcomp=pcomp*i/ | + | pcomp = pcomp * i / poss |
- | print " | + | print(" |
# calcul suivant l' | # calcul suivant l' | ||
# l' | # l' | ||
- | pcomps=exp(poss*log(poss)-poss - (poss-n)*log(poss-n) + (poss-n) - n*log(poss)) | + | pcomps = exp(poss*log(poss)-poss - (poss-n)*log(poss-n) + (poss-n) - n*log(poss)) |
- | print " | + | print(" |
- | </sxh> | + | </code> |
===== Problème analogue ===== | ===== Problème analogue ===== | ||
* Quelle est la probabilité de recevoir 40 cartes cadeaux différentes (aucun " | * Quelle est la probabilité de recevoir 40 cartes cadeaux différentes (aucun " | ||
Ligne 57: | Ligne 57: | ||
===== Références ===== | ===== Références ===== | ||
- | * [[http://fr.wikipedia.org/wiki/Paradoxe_des_anniversaires]] | + | * [[wp> |
- | * [[http://en.wikipedia.org/wiki/Birthday_problem]] | + | * [[wp> |
+ | * [[https://www.reddit.com/r/ | ||
+ | * [[https://towardsdatascience.com/ | ||
+ | * [[wp> | ||
+ | * [[wp> | ||
+ | * Cryptanalyse (informatique) | ||
+ | * [[wp> | ||
+ | * [[wp> | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | |||
+ | Extrait du thread twitter de @3blue1brown et des commentaires : | ||
+ | |||
+ | < | ||
+ | The birthday paradox is very famous in probability. If you take 23 people, there' | ||
+ | |||
+ | * Choose a random card from a deck of 52 cards. Put it back, shuffle well, and choose another. Do this for only 9 draws, and more likely than not, you've pulled the same card twice. Do it 16 times, and your chances are over 90%. Try it! | ||
+ | * Next time you're in an event with more than 118 people, think to yourself that there' | ||
+ | * The number of possible poker hands is 2,598,960. One hand for every person in Chicago, or 10 for each mile between the earth and the moon. How many hands would you think you'd have to draw before you've likely had the same *exact* hand twice? | ||
+ | * You can think of the birthday paradox by asking the probability of drawing 23 people successively so that each one has a birthday not yet seen. This gives the probability of no collision, so the probability of a collision is 1 minus this. The general formula for the probability of a collision when making k choices from a collection of N possibilities looks like $1-\frac{N!/ | ||
+ | </ |