File:Birthday paradox approximation.svg

Original file(SVG file, nominally 720 × 450 pixels, file size: 54 KB)

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

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.grid(True)
plt.legend([r"Probability: $\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
current16:09, 11 February 2016Thumbnail for version as of 16:09, 11 February 2016720 × 450 (54 KB)NicoguaroUser created page with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):

Global file usage

The following other wikis use this file:

Metadata