First, the probability of each possibility for each roll can be calculated, p(2)=1/36, p(3) = 2/36, ..., p(7) = 6/36, p(8) =5/36, p(9) = 4/36,..., p(12) = 1/36 At any stage, consider the set of all the outcomes that have no appeared yet, say (i1,i2,..., ik), which is a subset of (2,3,...,12) Let f((i1_,i_2,...,i_k)) be the exptected number of rolls in order for all of (i_1,i_2,...,i_k) to occur. Then we have the induction formula f( (i_1,i_2,...,i_k) ) = 1+ f( (i_2,...,i_k) ) p(i1) + f( (i_1,i_3,...,i_k)) p(i2)+... + f((i1,i2,..., i_(k-1)))p(ik) + f( (i_1,i_2,...,i_k) )(1-p(i_1)-p(i_2)-...p(i_k)) orwww.ddhw.com f( (i_1,i_2,...,i_k) ) = [1+ f( (i_2,...,i_k) ) p(i1) + f( (i_1,i_3,...,i_k)) p(i2)+... + f((i1,i2,..., i_(k-1)))p(ik) ]/(p(i_1)+p(i_2)+...p(i_k)) For the empty set, of cause, we have f( ) = 0. This can be implemented using a recursive function.
www.ddhw.com
本贴由[HF:]最后编辑于:2008-6-7 11:58:42 |