Цитата(indolent @ 11.6.2007, 11:28 ) | В партии 100 изделиий, из них 4 - бракованные. Партия произвольно разделена на две равные части, которые отправлены двум потребителям. Какова вероятность того, что все бракованные изделия достанутся: 1)одному потребителю 2)обоим потребителям поровну?
|
Вроде, задачки на гипергеометрическое распределение. Кажется так:
a) 2 * C(50, 4) / C(100, 4) = = 2 * 50!/((50 - 4)! * 4!) * ((100 - 4)! * 4!)/100! = = 2 * (50! * 96!) / (46! * 100!) = = 2 * 50/100 * 49/99 * 48/98 * 47/97 = = 2 * 188/3201 = 376/3201 ~= 0.1175...
b) (C(50, 2) * C(50, 2)) / C(100, 4) = = (50! / (48! * 2!)) * (50! / (48! * 2!)) * ((96! * 4!) / 100!) = = ((49 * 50) / 2) * ((49 * 50) / 2) * (24 / (97 * 98 * 99 * 100)) = = 1225/3201 ~= 0.3827...
И вот ещё (в качестве бонуса) небольшой файлик на Ruby, который помогает мне в решении подобных задачек:
| Код | #!/usr/bin/env ruby
# terver.rb # # Copyright Abandoned, 2007, Vadim A. Kazantsev aka V.A.KeRneL # <v.a.kernel@gmail.com>, Moscow, Russia. # # This file is part of `terver-rb' package. # # This file has been placed into the public domain by the author and may be # freely used for any purpose private or commercial. # # I would appreciate it, as a courtesy, if this notice is left in all copies # and derivative works. Thank you. # # The author makes no warranty of any kind with respect to this product and # explicitly disclaims any implied warranties of merchantability or fitness # for any particular purpose.
# Written by Vadim A. Kazantsev aka V.A.KeRneL # <v.a.kernel@gmail.com>, Moscow, Russia.
# # Created: 2007-Feb-11 20:36:00 # Last modified: 2007-Jun-11 19:12:00 # Version 1.0.0 #
require "mathn"
include Math
# # Extend standard class Integer with some new methods... # class Integer # # In mathematics, the factorial of a non-negative integer n is the # product of all positive integers less than or equal to n. This is # written as n! and pronounced "n factorial", or colloquially "n shriek", # "n bang" or "n crit". The notation n! was introduced by Christian # Kramp in 1808. # # Definition: # # n! := 1 * 2 * ... * (n - 1) * n (if n > 0) # 0! := 1 # def fact() #return 1 if self.zero? (2..self).inject(1) { |prod, val| prod * val } end # Integer#fact() end # class Integer
# # See description of Integer#fact. # def fact(n) #return 1 if (n == 0) (2..n).inject(1) { |prod, val| prod * val } end # fact()
# # In combinatorial mathematics, a combination is an un-ordered collection of # unique elements. (An ordered collection is called a permutation.) Given # S, the set of all possible unique elements, a combination is a subset of # the elements of S. The order of the elements in a combination is not # important (two lists with the same elements in different orders are # considered to be the same combination). Also, the elements cannot be # repeated in a combination (every element appears uniquely once). This is # because combinations are defined by the elements contained in them, so the # set {1, 1, 1} is the same as {1}. For example, from a 52-card deck any 5 # cards can form a valid combination (a hand). The order of the cards # doesn't matter and there can be no repetition of cards. # # The number of k-combinations (each of size k) from a set S with n elements # (size n) is the binomial coefficient. # # Definition: # # n /n\ n! # C(n, k) = C = ( ) = ------------- # k \k/ k! (n - k)! # def c(n, k) (n.fact / (k.fact * (n - k).fact)).to_i end # c() alias C c
# terver.rb ends here.
|
|