Last active
September 5, 2020 09:15
-
-
Save mithi/c9bc70e6a57f2150355ad40258426282 to your computer and use it in GitHub Desktop.
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 itertools import combinations | |
number_of_items = 8 | |
number_of_draws = 6 | |
iter_sets = combinations([i for i in range(number_of_items)], number_of_draws) | |
sets = list(iter_sets) | |
for s in sets: | |
print(s) | |
len(sets) | |
for s in sets: | |
cond = (0 in s) and (1 in s) and (2 in s) and (3 in s) | |
if cond: | |
print(s) | |
""" | |
(n choose d) | |
given n=8 distinct elements, draw all sets of d=6 elements. | |
QUESTION: how many of those sets have [0, 1, 2, 3]=[0...r=4 exclusive] | |
We can call subsetR=[0...r] | |
since r items of each set of d is fixed: | |
(since 4 items of each set of 6 is fixed) | |
6-element-set = subsetR + subsetV | |
1. v = d - r = 2 = number of items in the set that is not fixed (subsetV) | |
2. p = n - r = 4 = number of items that you can select for subsetV | |
(p choose v) | |
ANSWER: given p=4 distinct elements, draw all sets of v=2 | |
total number of combinations when you pick 10 of 100 | |
100! | |
---- | |
90!10! | |
total number of combinations of 10 that has (1, 2, 3, 4, 5) | |
v = 10 - 5 = 5 | |
p = 100 - 5 = 95 | |
95! | |
------ | |
90!5! | |
probability | |
95! | |
---- | |
90!5! | |
---------- | |
100! | |
---- | |
90!10! | |
""" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment