Jump to content

File:Birthday paradox approximation.svg

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia
Original file (SVG file, nominally 768 × 480 pixels, file size: 27 KB)
Any autoconfirmed user can overwrite this file from the same source. Please ensure that overwrites comply with the guideline.

Summary

Description
English: A graph comparing the accuracy of an approximation of the probability that in a room with n people (shown along the horizontal axis), some two (or more) will share a birthday. The black line, represents the computed probability. The red line represents the approximation
Español: Comparación entre la probabilidad de que dos personas (o más) en un cuarto compartan su cumpleaños (línea negra) y la aproximación:
Date
Source Own work
Author Nicoguaro
SVG development
InfoField
 The source code of this SVG is invalid due to an error.
 This W3C-invalid plot was created with Matplotlib.
 The file size of this SVG plot may be irrationally large because its text has been converted to paths inhibiting translations.
Source code
InfoField

Python code

#from __future__ import division # Python 2
import numpy as np
from scipy.special import perm
import matplotlib.pyplot as plt
from matplotlib import rcParams

rcParams['font.family'] = 'serif'
rcParams['font.size'] = 14
rcParams['svg.fonttype'] = 'none'

num = np.linspace(1, 100, 100)
p = 1 - perm(365, num)/365.**num
p_approx = 1 - np.exp(-num**2/730)

plt.figure(figsize=(8, 5))
plt.step(num, p, "k", lw=2)
plt.plot(num, p_approx, "r", lw=1)
plt.xlabel(r"Number of people - $n$")
plt.ylabel("Probability of a pair")
plt.xlim(0, 100)
plt.ylim(0, 1)
plt.grid(True)
plt.legend([r"Probability: $1-\frac{365!}{365^n (365 - n)!}$",
            r"Approximation: $1-e^\frac{-n^2}{2\cdot 365}$"], loc=4)
plt.savefig("Birthday paradox approximation.svg")
plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

11 February 2016

image/svg+xml

51e1f8c32f72c3e55048195ccbff1bffb3ccbff1

55,676 byte

450 pixel

720 pixel

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current03:49, 20 October 2025Thumbnail for version as of 03:49, 20 October 2025768 × 480 (27 KB)Based5290use text for text instead of paths
05:12, 28 September 2025Thumbnail for version as of 05:12, 28 September 2025768 × 480 (43 KB)Based5290tighter bounds
05:08, 28 September 2025Thumbnail for version as of 05:08, 28 September 2025768 × 480 (44 KB)Based5290Corect error in legend
16:09, 11 February 2016Thumbnail for version as of 16:09, 11 February 2016720 × 450 (54 KB)NicoguaroUser created page with UploadWizard

The following 2 pages use this file:

Global file usage

The following other wikis use this file:

Metadata