File:Birthday paradox approximation.svg
From testwiki
Jump to navigation
Jump to search
Original file (SVG file, nominally 768 × 480 pixels, file size: 27 KB)
Contents
This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.
Summary
| DescriptionBirthday paradox approximation.svg |
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 | |
| 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:
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
450 pixel
720 pixel
27,639 byte
6911fd8c49107e27838df9ea692b74e5318a4617
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 04:49, 20 October 2025 | 768 × 480 (27 KB) | wikimediacommons>Based5290 | use text for text instead of paths |
File usage
There are no pages that use this file.