File:Probabilidade paradoxo do aniversário.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 576 × 432 pixels, file size: 34 KB)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
Português: grafico do paradoxo do aniversário
Date
Source Own work
Author Lechatjaune

Licensing

[edit]

Summary

[edit]
Description
Português: Gráfico da probabilidade de pareamento no W:pt:paradoxo do aniversariante. Baseado em Birthday_Paradox.svg
Date
Source Own work
Author Lechatjaune
SVG development
InfoField
 
The SVG code is valid.
 
This plot was created with Matplotlib.
 
 This plot uses embedded text that can be easily translated using a text editor.
Source code
InfoField

Python code

#Cálculo das probabilidades para o paradoxo do aniversariante
#Veja: https://pt.wikipedia.org/wiki/Paradoxo_do_anivers%C3%A1rio

import matplotlib.pyplot as plt

probabilidades = [0,]
p = 1
n_dias = 60 # número de dias a calcular

for i in range(0, n_dias):
      p *= (1 - i/365)   # Anos bissextos são desprezados 
      probabilidades.append(1 - p)


# Plota o gráfico
fig, ax = plt.subplots(1, 1)

plt.step(range(0, n_dias+1), probabilidades)

# Definições de eixos
ax.xaxis.set_ticks_position('bottom')
ax.set_ylim(bottom=0, top=1)
ax.set_xlim(left=0, right=n_dias)


# Adiciona rótulo aos eixos
plt.xlabel('número de pessoas', fontsize=14)
plt.ylabel('probabilidade de pareamento', fontsize=14)

# Adiciona grelha
plt.grid(True)

# Adiciona linha de ~50%
h = probabilidades[23] 
plt.plot([0, 23], [h, h], color='red', linestyle='dotted', linewidth=2)
plt.plot([23, 23], [0, h], color='red', linestyle='dotted', linewidth=2)

# Escreve p(23) = 0.507
ax.text(24, 0.25, 'p(23) = {:.3f}'.format(h), horizontalalignment='left', fontsize=14)

plt.savefig('probabilidade.svg', format='svg')

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 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.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 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.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

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

Date/TimeThumbnailDimensionsUserComment
current01:30, 20 March 2020Thumbnail for version as of 01:30, 20 March 2020576 × 432 (34 KB)Lechatjaune (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

  • Usage on www.wikidata.org

Metadata