Datei:Birthdaymatch.svg
Aus besserwiki.de
Größe der PNG-Vorschau dieser SVG-Datei: 720 × 540 Pixel. Weitere Auflösungen: 320 × 240 Pixel | 640 × 480 Pixel | 1.024 × 768 Pixel | 1.280 × 960 Pixel | 2.560 × 1.920 Pixel.
Originaldatei (SVG-Datei, Basisgröße: 720 × 540 Pixel, Dateigröße: 291 KB)
Diese Datei stammt aus Wikimedia Commons und kann von anderen Projekten verwendet werden. Die Beschreibung von deren Dateibeschreibungsseite wird unten angezeigt.
Beschreibung
BeschreibungBirthdaymatch.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. |
Datum | |
Quelle | Eigenes Werk |
Urheber | Guillaume Jacquenot |
SVG‑Erstellung InfoField | Dieser W3C-invalide Plot wurde mit Matplotlib erstellt. |
Quelltext 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')
|
Lizenz
Ich, der Urheber dieses Werkes, veröffentliche es unter der folgenden Lizenz:
Diese Datei ist unter der Creative-Commons-Lizenz „Namensnennung – Weitergabe unter gleichen Bedingungen 3.0 nicht portiert“ lizenziert.
- Dieses Werk darf von dir
- verbreitet werden – vervielfältigt, verbreitet und öffentlich zugänglich gemacht werden
- neu zusammengestellt werden – abgewandelt und bearbeitet werden
- Zu den folgenden Bedingungen:
- Namensnennung – Du musst angemessene Urheber- und Rechteangaben machen, einen Link zur Lizenz beifügen und angeben, ob Änderungen vorgenommen wurden. Diese Angaben dürfen in jeder angemessenen Art und Weise gemacht werden, allerdings nicht so, dass der Eindruck entsteht, der Lizenzgeber unterstütze gerade dich oder deine Nutzung besonders.
- Weitergabe unter gleichen Bedingungen – Wenn du das Material wiedermischst, transformierst oder darauf aufbaust, musst du deine Beiträge unter der gleichen oder einer kompatiblen Lizenz wie das Original verbreiten.
In dieser Datei abgebildete Objekte
Motiv
10. März 2013
image/svg+xml
68b9c96e2a245296ec08bbfe7963536985e6cf9e
297.936 Byte
540 Pixel
720 Pixel
Dateiversionen
Klicke auf einen Zeitpunkt, um diese Version zu laden.
Version vom | Vorschaubild | Maße | Benutzer | Kommentar | |
---|---|---|---|---|---|
aktuell | 21:39, 10. Mär. 2013 | 720 × 540 (291 KB) | wikimediacommons>Gjacquenot | User created page with UploadWizard |
Dateiverwendung
Die folgende Seite verwendet diese Datei:
Metadaten
Diese Datei enthält weitere Informationen, die in der Regel von der Digitalkamera oder dem verwendeten Scanner stammen. Durch nachträgliche Bearbeitung der Originaldatei können einige Details verändert worden sein.
Breite | 576pt |
---|---|
Höhe | 432pt |
Abgerufen von „http://besserwiki.de/wiki/Datei:Birthdaymatch.svg“