This equivalent to having six boxes labeled each one of \(A,~B,~C,~D,~E,~F\) [no repeats].In a box contain 6 balls, written A,B,C,D,E and F.
A boy randomly draw one ball from the box with replacement and repeated for 30 times.
What is the probability that he at least draw the balls A,B,C,D and E for 3 times respectively?
This equivalent to having six boxes labeled each one of \(A,~B,~C,~D,~E,~F\) [no repeats].
How many can we put thirty identical marbles into those six distinct boxes. Well \(\dbinom{30+6-1}{5}\).
That is the number of elementary events in the total probability space.
At this point I guess that he draws balls A, B,C,D,E [NOT F] at least three times each.
Lets take fifteen of the marbles and then put three each into those five boxes.
How many ways can we now put the fifteen remaining marbles into the six boxes? \(\dbinom{15+6-1}{5}\)
That is the number of elementary events in which each of the five boxes contains at least three marbles[choices or selections]
LOOK HERE for the calculation.
If I have missread your question please try to restate it more clearly.
This equivalent to having six boxes labeled each one of \(A,~B,~C,~D,~E,~F\) [no repeats].
How many can we put thirty identical marbles into those six distinct boxes. Well \(\dbinom{30+6-1}{5}\).
That is the number of elementary events in the total probability space.
At this point I guess that he draws balls A, B,C,D,E [NOT F] at least three times each.
Lets take fifteen of the marbles and then put three each into those five boxes.
How many ways can we now put the fifteen remaining marbles into the six boxes? \(\dbinom{15+6-1}{5}\)
That is the number of elementary events in which each of the five boxes contains at least three marbles[choices or selections]
LOOK HERE for the calculation.
If I have missread your question please try to restate it more clearly.
Here is a whole page on multi-sets. Reading the whole article will answer all your quedtions.Wow pka, thank for your detailed answer! Thank for simplifying my question and make it more comprehensible! But i am curious to know that why we need to +6−1 when finding the combination~
Catch you after understand it!!Here is a whole page on multi-sets. Reading the whole article will answer all your quedtions.
Here is a whole page on multi-sets. Reading the whole article will answer all your quedtions.
n5 n1 x a b c d
3 3 3 3 3 15 choose(30,15) 15!/(3!*3!*3!*3!*3!) (t-5)^(30-15) 5!/(5!)
3 3 3 3 4 16 choose(30,16) 16!/(4!*3!*3!*3!*3!) (t-5)^(30-16) 5!/(4!)
...
3 3 3 3 18 30 choose(30,30) 30!/(18!*3!*3!*3!*3!) (t-5)^(30-30) 5!/(4!)
3 3 3 4 4 17 choose(30,17) 17!/(4!*4!*3!*3!*3!) (t-5)^(30-17) 5!/(3!*2!)
3 3 3 4 5 18 choose(30,18) 18!/(5!*4!*3!*3!*3!) (t-5)^(30-18) 5!/(3!)
...
6 6 6 6 6 30 choose(30,30) 30!/(6!*6!*6!*6!*6!) (t-5)^(30-30) 5!/(5!)
where t=6 (the number of balls in the bag).
from sympy.functions.combinatorial.numbers import stirling
from sympy import binomial
from math import factorial
# I could not find the following function in an existing Python library
# https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
# An r-associated Stirling number of the second kind returns
# the number of ways to partition a set of n objects into k subsets,
# with each subset containing at least r elements */
def stirling2r_private(r,n,k, cache):
if n==0 and k==0: return 1
if k<=0 or k*r>n: return 0
if k==1: return 1
if cache[n][k]!=-1: return cache[n][k]
n-=1
rv = stirling2r_private(r,n-r+1,k-1, cache)
if rv!=0: rv *= binomial(n,r-1)
rv += k*stirling2r_private(r,n,k, cache)
n+=1
cache[n][k]=rv
return rv
def stirling2r(r,n,k):
if r==1: return stirling(n,k)
if k<=0 or k*r>n: return 0
# initialise a [k+1] [n+1] array...
cache=[ [-1]*(k+1) for i in range(n+1) ]
rv=stirling2r_private(r,n,k, cache)
return rv
#################################################################
m=5 # Number of balls to match
t=6 # Number of balls in the bag
p=30 # Number of picks
minim=3 # Minimum number of matches per ball
r=0
for i in range(p-minim*m+1):
r += stirling2r(minim, p-i, m) * factorial(m) * binomial(p,i) * (t-m)**i
print("Probability is", r, "/", t**p)
print("Or approx ", float(r) / t**p)