Created
May 25, 2023 00:17
-
-
Save dmarzzz/d81dd17cf27a70dee394f6fb651445ef to your computer and use it in GitHub Desktop.
orobability of controlling >50% of an N-size committee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from decimal import Decimal | |
import math | |
def calculate_summation(N, p): | |
p = Decimal(p) | |
result = Decimal(0) | |
for k in range(math.floor(N/2), N+1): | |
term = Decimal(math.comb(N, k)) * (p**k) * ((1-p)**(N-k)) | |
result += term | |
return float(result) | |
# Testing the function | |
N = 9000 | |
p = 0.40 | |
result = calculate_summation(N, p) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment