T.R | Title | User | Personal Name | Date | Lines |
---|
2030.1 | suggested approach | FLOYD::YODER | MFY | Thu Feb 22 1996 10:02 | 3 |
| If you *don't* have at least 1 red and 3 black, you must have 0 red and either
0, 1, or 2 black. Perhaps it's easy to treat those 3 cases separately, add the
results, and subtract from C(60,10).
|
2030.2 | | AUSSIE::GARSON | achtentachtig kacheltjes | Wed Feb 28 1996 03:50 | 7 |
| re .1
Subtracting from C(60,10) implies that the 60 objects are distinct.
This is OK as long as you also take this approach when you count the
number of ways to get 0, 1 or 2 black.
Either way this gets pretty hairy in the general case.
|
2030.3 | | HANNAH::OSMAN | see HANNAH::IGLOO$:[OSMAN]ERIC.VT240 | Wed Feb 28 1996 10:52 | 47 |
| 19 black, 4 red, 37 white, I pull out 10. What is probablility that
I have at least 1 red and at least 3 black ?
I would approach it this way:
I would look at all the possibilities of what I might have pulled.
At least 1 red means 1 red or 2 red or 3 red or 4 red. So I would add up
how many ways I can have exactly 1 red plus the ways I can have exactly 2 reds
plus the ways I can have exactly 3 plus exactly 4.
But it's not quite as simple, since I want at least 3 black too.
So, I want at least 1 r and at least 3 b. The possibilities of interest are
these
exactly 1r + 3b
exactly 2r + 3b
exactly 3r + 3b
exactly 4r + 3b
exactly 1r + 4b
exactly 2r + 4b
...
exactly 4r + 6b
Each of these possibilities are distinct, that is, they don't overlap. So
We can ADD their probabilities.
p(1r+3b) = ???
p(1r+3b) is a bit challenging in itself. We need to know how many ways we
can pick exactly 1 r and 3 b. Agan, I'd divide this into distinct cases so
we will be allowed to add their probabilities. The 1 r can be in 10 different
positions, and for each of those 10, the 3 b's can be in (9,3) different
arrangements.
I think I could really solve this if I put my mind to it. However, my
general suspicion is that your original problem as posed is MUCH HARDER than
the actual problems you were given in school in the past.
My specific surface-scratching solution started up above really all amounts
to listing EVERY possible way to pick the 10 balls, and use that as the bottom
of a fraction whose top consists of counting the cases that qualify as "at
least 1 red and at least 3 black". This fraction is your answer.
/Eric
|
2030.4 | a small C program will help | GVAADG::DUBE | Zero is not not not zero, or is it? | Wed Feb 28 1996 13:54 | 89 |
| >> p(1r+3b) = ???
this is C(4,1) * C(19,3) * C(37,6) / C(60,10)
^ ^
^ ^ | |
| | 6 whites Universe of all combinations
1 red 3 blacks over 37
over over 19 poss
4 possibilities
In general, the proba to have "r read + b black + w white" is:
P(r, b, w) = C (4,r) * C (19,b) * C(37,w) / C(60,10)
So, to have "at least one red" and "at least 3 blacks", we get
r=4 b=10-r
P = SUM SUM C(4,r) * C(19,b) * C(37,10-r-b) / C(60,10)
r=1 b=3
I got P = 0.33138659, using this following C program
{for compiling : Extract it as balls.c
CC balls.c
define lnk$library sys$library:vaxcrtl.olb
Link balls
Run Balls
}
Friendly,
##### Remy #####
ps: and now, here is the C program:
#include <stdio.h>
#include <math.h>
const tot_red = 4;
tot_black = 19;
tot_white = 37;
tot_withdraw= 10; /* want to pull out 10 of them */
min_red = 1; /* want at least 1 red */
min_black = 3; /* want at least 3 blacks */
/*******************************************************************************
computes here the factorielle of n, i.e. n*(n-1)*...*1; with fact(0) = 1 *
*******************************************************************************/
double fact (int n)
{double result = 1.0;
for (;n>0;n--) result *= n;
return result;
}
/*******************************************************************************
computes now number of combinations of n objects, selected by set of p elements
*******************************************************************************/
double comb (int n, int p)
{double result = 1.0;
for (; p>0; p--, n--) result = result * n / p;
return result;
}
/*******************************************************************************
MAIN COMPUTATION
*******************************************************************************/
main ()
{int r, b, w;
double proba, cumulated_proba =0;
double univers = comb(tot_red+tot_black+tot_white, tot_withdraw);
for (r=min_red; r<=tot_red && r <= tot_withdraw; r++)
for (b=min_black; b<=tot_black && b+r<= tot_withdraw; b++)
{w = tot_withdraw-b-r;
proba = comb(tot_red,r)*comb(tot_black,b)*comb(tot_white,w) / univers;
cumulated_proba += proba;
printf("%2d %2d %2d %10.8f %10.8f\n", r, b, w, proba, cumulated_proba);
}
}
|
2030.5 | | CSC32::D_DERAMO | Dan D'Eramo, Customer Support Center | Wed Feb 28 1996 19:54 | 6 |
| The previous replies give 24,984,569,384 of the 75,394,027,566
= C(60,10) possible combinations for a probability of
24984569384/75394027566 = 38,675,804/116,709,021 = approx.
0.331386585789285302975851369706888.
Dan
|
2030.6 | Special thanks to Remy | FORTY2::BOYES | My karma ran over my dogma | Thu Feb 29 1996 06:04 | 6 |
| Dan et al,
I was expecting there to be a simple algorithm, but a prgram to thrash it
out is great! Thanks a lot!
+Mark+
|
2030.7 | | CSC32::D_DERAMO | Dan D'Eramo, Customer Support Center | Thu Feb 29 1996 10:22 | 22 |
| >I was expecting there to be a simple algorithm, but a prgram to thrash it
>out is great! Thanks a lot!
The simple algorithm is there in reply .4 as well.
There are C(60,10) ways to select 10 of 4+19+37 = 60
distinguishable balls without replacement. The number of
those ways with r red, b black, and w white is implicit in the
formula from .4, which gave the probability as that number
ways divided by C(60,10) ...
>In general, the proba to have "r read + b black + w white" is:
> P(r, b, w) = C (4,r) * C (19,b) * C(37,w) / C(60,10)
Just add up the total count or the probabilities for each
(r,b,w) combination that meets your criteria. That's the
simple algorithm:
number_ways = sum for each acceptable (r,b,w) of
C(4,r) * C(19,b) * C(37,w)
probability = number_ways / C(60,10)
Dan
|
2030.8 | | FORTY2::BOYES | My karma ran over my dogma | Thu Feb 29 1996 11:37 | 14 |
| > simple algorithm:
>
> number_ways = sum for each acceptable (r,b,w) of
> C(4,r) * C(19,b) * C(37,w)
> probability = number_ways / C(60,10)
Yep I grasped that, and thats my idea of a simple algorithm too, but what I
expected was there to be a simple formula that didn't involve the 'each
acceptable' clause: whilst I'm happy with it, I expected there to be fewer
implicit 'sigmas' in the solution.
Thanks again,
+Mark+
|