mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-29 07:47:57 +02:00
added my TikZ examples
This commit is contained in:
parent
dc9eb91aa2
commit
fef9415b3d
92 changed files with 3624 additions and 0 deletions
14
tikz/birthday-paradox/calculate.py
Normal file
14
tikz/birthday-paradox/calculate.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from math import factorial
|
||||
from gmpy import bincoef
|
||||
|
||||
f = open('data.csv', 'w')
|
||||
f.write('People\tprobability\n')
|
||||
|
||||
def prob(people):
|
||||
return 1.0 - float(factorial(people)*bincoef(365,people))/(365**people)
|
||||
|
||||
for people in xrange(60+1):
|
||||
f.write("%i\t%f\n" % (people, prob(people)))
|
Loading…
Add table
Add a link
Reference in a new issue