Fichier:Birthdaymatch FR.svg
Le contenu de la page n’est pas pris en charge dans d’autres langues.
Taille de cet aperçu PNG pour ce fichier SVG : 720 × 540 pixels. Autres résolutions : 320 × 240 pixels | 640 × 480 pixels | 1 024 × 768 pixels | 1 280 × 960 pixels | 2 560 × 1 920 pixels.
Fichier d’origine (Fichier SVG, nominalement de 720 × 540 pixels, taille : 296 kio)
Ce fichier et sa description proviennent de Wikimedia Commons.
Description
DescriptionBirthdaymatch FR.svg |
English: In probability theory, the birthday problem or birthday paradox concerns the probability that, in a set of n randomly chosen people, some pair of them will have the same birthday. By the pigeonhole principle, the probability reaches 100% when the number of people reaches 367 (since there are 366 possible birthdays, including February 29). However, 99% probability is reached with just 57 people, and 50% probability with 23 people. These conclusions are based on the assumption that each day of the year (except February 29) is equally probable for a birthday.
The mathematics behind this problem led to a well-known cryptographic attack called the birthday attack, which uses this probabilistic model to reduce the complexity of cracking a hash function. |
Date | |
Source | Travail personnel |
Auteur | Guillaume Jacquenot |
SVG information InfoField | Le code de ce fichier SVG n'est pas valide en raison de 242 erreurs. Cette représentation graphique W3C-invalide a été créée avec Matplotlib |
Code source InfoField | Python code# -*- coding: utf-8 -*-
#
# Script to generate in English and French, graphs for the
# birthday problem.
# More precisely, it generates two SVG files representing the
# probability of no match of two identical birthday one the same
# wrt the number of person in the considered group.
#
# **************************************************************
# http://en.wikipedia.org/wiki/Birthday_problem
# From Wikipedia, the free encyclopedia:
# In probability theory, the birthday problem or birthday
# paradox concerns the probability that, in a set of n
# randomly chosen people, some pair of them will have the
# same birthday. By the pigeonhole principle, the probability
# reaches 100% when the number of people reaches 367
# (since there are 366 possible birthdays, including February
# 29). However, 99% probability is reached with just 57 people,
# and 50% probability with 23 people. These conclusions are
# based on the assumption that each day of the year (except
# February 29) is equally probable for a birthday.
#
# The mathematics behind this problem led to a well-known
# cryptographic attack called the birthday attack, which
# uses this probabilistic model to reduce the complexity
# of cracking a hash function.
#
# Text under the
# Creative Commons Attribution-ShareAlike License
# **************************************************************
#
# Implementation:
# To ensure numerical accuracy, one evaluates the log10 of the
# probabibity of no match. This allows to converts the
# probability formula from a product formula to a sum formula.
#
#
# Guillaume Jacquenot
# 2013/03/10
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Palatino'],'size':14})
rc('text', usetex=True)
import numpy as np
def BirthdaymatchComputationLog10():
'''
This function evaluates the log10 probability of no
match for the birthday paradox.
This ensures no approximation on the result.
$\log _{10} \left( {\bar p(n)} \right) =
\sum\limits_{i = 365 + 1 - n}^{365}
{\log _{10} \left( i \right)}
- n\log _{10} \left( {365} \right)$
'''
n=np.arange(1,365)
nR=np.arange(365,1,-1)
p=np.cumsum(np.log10(nR))-n*np.log10(365)
return n,p
def BirthdaymatchGenerateTitle(logTitle=False):
if logTitle:
title='$\\log _{10} \\left( {\\bar p(n)} \\right)\
= \\sum\\limits_{i = 365 + 1 - n}^{365}\
{\\log _{10} \\left( i \\right)}\
- n\\log _{10} \\left( {365} \\right)$'
else:
title='$\\bar p(n) = \\frac{365!}{365^n\
\\left( {365 - n} \\right)!}$'
return title
def Birthdaymatch(\
labels={'xlabel':'Number of people',\
'ylabel':'Probability of no match',\
'title':'Birthday paradox'},\
outputFilename = r'Birthdaymatch.svg'):
n,p = BirthdaymatchComputationLog10()
fig, ax = plt.subplots()
plt.plot(n,p,c='k', linestyle='-')
plt.grid(True, ls='-', c='#a0a0a0')
plt.xlabel(labels['xlabel'])
plt.ylabel(labels['ylabel'])
plt.title(labels['title']+' - '+BirthdaymatchGenerateTitle())
fig.canvas.draw()
labels = [item.get_text() for item in ax.get_yticklabels()]
labels = [label[1:] if label.startswith('$') else label for label in labels]
labels = [label[0:-1] if label.endswith('$') else label for label in labels]
labels = ['$10^{'+label+'}$' for label in labels]
ax.set_yticklabels(labels)
plt.savefig(outputFilename)
Birthdaymatch()
Birthdaymatch(\
labels={'xlabel':u"Nombre de personnes",\
'ylabel':u"Probabilit\\'e de non correspondance",\
'title':u"Paradoxe des anniversaires"},\
outputFilename = r'Birthdaymatch_FR.svg')
|
Conditions d’utilisation
Moi, en tant que détenteur des droits d’auteur sur cette œuvre, je la publie sous la licence suivante :
Ce fichier est disponible selon les termes de la licence Creative Commons Attribution – Partage dans les Mêmes Conditions 3.0 (non transposée).
- Vous êtes libre :
- de partager – de copier, distribuer et transmettre cette œuvre
- d’adapter – de modifier cette œuvre
- Sous les conditions suivantes :
- paternité – Vous devez donner les informations appropriées concernant l'auteur, fournir un lien vers la licence et indiquer si des modifications ont été faites. Vous pouvez faire cela par tout moyen raisonnable, mais en aucune façon suggérant que l’auteur vous soutient ou approuve l’utilisation que vous en faites.
- partage à l’identique – Si vous modifiez, transformez, ou vous basez sur cette œuvre, vous devez distribuer votre contribution sous la même licence ou une licence compatible avec celle de l’original.
Éléments décrits dans ce fichier
dépeint
10 mars 2013
image/svg+xml
1554636753b2138f5a266652573eb17bcfbf1712
303 308 octet
540 pixel
720 pixel
Historique du fichier
Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.
Date et heure | Vignette | Dimensions | Utilisateur | Commentaire | |
---|---|---|---|---|---|
actuel | 10 mars 2013 à 21:51 | 720 × 540 (296 kio) | Gjacquenot | User created page with UploadWizard |
Utilisation du fichier
La page suivante utilise ce fichier :
Métadonnées
Ce fichier contient des informations supplémentaires, probablement ajoutées par l'appareil photo numérique ou le numériseur utilisé pour le créer.
Si le fichier a été modifié depuis son état original, certains détails peuvent ne pas refléter entièrement l'image modifiée.
Largeur | 576pt |
---|---|
Hauteur | 432pt |
Ce document provient de « https://fr.wikipedia.org/wiki/Fichier:Birthdaymatch_FR.svg ».