81 coaches online • Server time: 12:56
* * * Did you know? The most touchdowns in a single match is 23.
Log in
Recent Forum Topics goto Post FUMBBL Memesgoto Post Should natural onetu...goto Post New rules are leaked
stej
Last seen 13 hours ago
Chaos Chosen
Emerging Star
Chaos Chosen
Record
45/25/83
Win Percentage
38%
Dark Elf
Star
Dark Elf
Record
13/4/13
Win Percentage
50%
Overall
[R]
Emerging Star
Overall
Record
55/28/97
Win Percentage
38%
Archive

2020

2020-08-01 01:51:16
rating 5.8

2018

2018-07-29 00:27:56
rating 4.8

2016

2016-02-24 23:51:07
rating 5
2016-02-18 19:48:31
rating 3.1

2013

2013-03-23 20:41:13
rating 2.7

2012

2012-11-20 19:23:15
rating 4.6
2012-07-19 13:01:15
rating 4.4
2012-07-18 09:38:15
rating 4.8
2012-02-29 14:31:25
rating 1.3

2011

2011-12-11 00:35:00
rating 5.2
2011-11-15 08:30:29
rating 3
2011-11-11 08:48:18
rating 1.7
2011-05-11 00:59:03
rating 4.1
2011-04-20 01:13:41
rating 3.9
2011-04-11 00:00:46
rating 2.8
2011-02-24 10:30:07
rating 4.6
2011-01-18 13:30:46
rating 3.4

2010

2010-10-02 18:05:51
rating 2.5
2010-09-23 19:23:54
rating 2.8
2016-02-18 19:48:31
7 votes, rating 3.1
Off Topic : Math Problem
Hi All,

I'm struggling with the following math problem. Whilst I can brute force the answer fairly easily with the computer I was hoping there was a general solution I can use.

As you guys are all very good with probablilities and the like I thought you may be able to assist

This involves combitorial maths and sampling without replacement

So onto the problem
I have a jar containing x Red marbles, y Green marbles and z Blue marbles
if I draw marbles out of the jar one by one (without replacement) what ae the chances that I draw n Red marbles before I have drawn at least one Green and Blue marble. x,y,z >= 0 0<n<=x

So for a jar with 4 marbles, 2 red, 1 green and 1 blue and n = 2 we would succeed if we drew RRGB RRBG RGRB RBRG GRRB BRRG and would fail if we drew BGRR GBRR RGBR RBGR BRGR GRBR.

How would this work if we had more colours of marbles (i.e. i Yellow marbles)

Any help on this would be greatly appreciated
Rate this entry
Comments
Posted by bujke on 2016-02-18 20:28:42
Giving it a try:

If you have x Red marbles out of a total of P marbles (P is Red + Green + Blue), the odds of getting the first marble as red would be:

x/P

The odds of getting the second marble as Red (once the first is drawn as red) is:

(x-1)/(P-1)

The odds of getting the nth marble as Red (assuming all drawn before it were red) is:

(x-n+1)/(P-n+1)

The odds of getting the first N marbles as red is:

x/P * (x-1)/(P-1) * ... * (x-N+1)/(P-N+1)

or putting it differently:

n=N
∏ (x-n+1)/(P-n+1);
n=0

where x is the start number of Red marbles, P is the start number of all marbles, N is the desired number of drawn Red marbles and n is the number of the current draw.

As for ∏,
https://en.wikipedia.org/wiki/Product_%28mathematics%29#Product_of_sequences

Hope this was what you were looking for.

Cheers.
Posted by bujke on 2016-02-18 20:30:24
n=N
∏ (x-n+1)/(P-n+1);
n=0

should be:

n=N-1
∏ (x-n+1)/(P-n+1);
n=0
Posted by SzieberthAdam on 2016-02-18 20:37:04
n goes from 1 to N
Posted by Squiglet on 2016-02-18 20:40:07
Or another way...

break it down into the following stages, as you seek the Prob of exactly n reds you have the following possibilities:

Draw i Rs then B AND draw n-i Rs then G
OR
Draw i Rs then G AND draw n-1 Rs then B

So..

Sum(i=0 to n) P(draw i R then G) x P(draw n-i then B) +
Sum(i=0 to n) P(draw i R then B) x P(draw n-i then G)
Posted by bujke on 2016-02-18 20:41:58
Yeah, you're right, n goes from 1 to N.
Posted by Squiglet on 2016-02-18 20:54:21
@bujke he does not need to draw all red before the first green or blue bur n reds before drawing one green and one blue

my analysis above misses out the possibility of drawing additional copies of the first colour - will have another head scratch...
Posted by Squiglet on 2016-02-18 20:57:49
Sum(i=0 to n) P(draw i R then G) x P(draw w (R or G) then B) x P(n-i of w R) +
Sum(i=0 to n) P(draw i R then B) x P(draw w (R or B) then G) x P(n-i of w R)

should fix it
Posted by bujke on 2016-02-18 21:06:15
@Squiglet yeah, i went completely off, didn't read the setup properly.
Posted by PainState on 2016-02-18 21:20:27
Math is stupid, just rip up the math sheet, wipe your ass crack with it and declare you have solved the problem, walk off and just let every body stare at you in shock.

2 hours later you will have two nice female students meet up with you after class. 100% chance of success.
Posted by SzieberthAdam on 2016-02-18 21:25:04
I see the problem is much more complicated. We want to draw N red before drawing at least one piece of grean and blue and yellow and whatever each, right? Reds can be drawn in separate sequences as well as other colors until a single color is undrawn.

The question is what is the chance of drawing n reds and any number of blues and yellows before drawing a green. Same for blue and yellow.
Posted by Endzone on 2016-02-18 21:40:17
I'll limit myself to trying to answer the simple scenario of there only being 1 green and 1 blue marble. In this case the probability of drawing n reds before both the blue and the green is simply the probability that the last colour ball in the full sequence of drawing all the balls is not red. Thinking about it this way we are just selecting one ball from the bag (the last ball) which simplifies things considerably. The probability of the last ball being red is g+b/r+g+b or 2/r+2.
Posted by Endzone on 2016-02-18 21:57:00
ref. PainState

"2 hours later you will have two nice female students meet up with you after class."

I guess you weren't studying maths then?

"100% chance of success."

Now I know you weren't a maths student!
Posted by stej on 2016-02-18 22:09:06
Agggh! Its frustraiting isn't it. Even looking at 2 Red 2 Green and 1 Blue starts making it rather complex!

Doing conditional probability statements gets rather difficult as we go further down the rabbit hole
Posted by licker on 2016-02-18 22:38:01
I'm half asleep today, but isn't this just about mapping out the probability space with respect to draw sequences?

Surely the numbers can get big, but it shouldn't be that difficult to actually work out.

Really you're just looking at what is the probability that your last color is drawn after n Red and any combination of other colors are drawn. So if you have 3 marbles each of 3 colors, what is the probability that one of the colors (doesn't matter which one if the number of them is the same in this case) doesn't get drawn until after any combination of the other colors is drawn.

You can either draw out the tree for small sets or you can work out the maths as you prefer for larger sets.
Posted by stej on 2016-02-18 23:21:09
Interesting point there licker. I think that that is very much right where n = x. Does this hold for n < x (i.e. 3 reds, 2 drawn before hitting one of the others) I'll have to have a think.

Squidgets notation is good so thanks for the logic there.

Just for a bit of context, I'm looking to have an initiatve system for deciding who goes next based on this above concept with the round ending when all players have had a t least one go.
As this would mean people with higher initiative possibly getting multiple goes in a round I would need to balance stats accordingly to make things fair so this is where the different values of n come in
so in a 3,2,1 example, the first player could get 1,2 or 3 goes depending on the probabilities.
I'm also curious to see how it works with bigger numbers as it appears you will be more likely to get multiple turns if there are more opponents which could give this system too much of an advantage if you have better initiative
Posted by Squiglet on 2016-02-18 23:26:32
Here goes - test this against your brute force method...

Using notation xPy = x.(x-1).(x-2)...(x-y+1) and N=x+y+z

Sum(i=0 to n) [xPi/NPi . yP1/(N-i)P1
. Sum(w=n-i to n-i+y-1) [(x+y-i-1)Pw/(N-i-1)Pw
. (x-i)P(n-i)/(x+y-i-1)P(n-i) . zP1/(N-i-1-w)P1
. (y-1)P(w-n+i)/(x+y-n+i)P(w-n+i) . wP(n-i)]]
+
Sum(i=0 to n) [xPi/NPi . zP1/(N-i)P1
. Sum(w=n-i to n-i+z-1) [(x+z-i-1)Pw/(N-i-1)Pw
. (x-i)P(n-i)/(x+z-i-1)P(n-i) . yP1/(N-i-1-w)P1
. (z-1)P(w-n+i)/(x+z-n+i)P(w-n+i) . wP(n-i) ]]


for those who will correct the errors in this, the logic is:

Sum over Probs of gaining chain of i Reds followed by one Green x Sum over probs of gaining chain of w (Reds or Greens) followed by one Blue x Prob that exactly n-i of the w are Red

Plus the same with Blue and Green swapped...

I feel like this has about the same chance of being right as a goblin surviving a TTM attempt from a starving troll...
Posted by Squiglet on 2016-02-18 23:35:41
Sorry last comment - I see a simplification where ever I put

aP1/bP1 replace with a/b (obviously)
Posted by dode74 on 2016-02-19 00:05:26
"Plus the same with Blue and Green swapped..."

Which is the same as 2.(f), where (f) is your base function (assuming it is right, of course!). And with 3 additional colours, e.g. blue, green, yellow, it would be 6.(f) (RGY, RYG, GYR, GRY, YRG, YGR). With 4 it would be 24, so the number of additional colours is a factorial function of the base formula. So we can add different numbers of colours as required for them and factor them in as [Total number of additional colours] = C, so the overall formula would be C!.(f)

Or have I got that hopelessly wrong?
Posted by Endzone on 2016-02-19 10:51:51
Hi Stej,

I have just read your context. Nice idea. however, I think you have asked the wrong question. I think what you really want is the average number of turns (expectancy) for each character for given initiative values for each character. I think the practical solution you need is to build a table rather than find a formula.
Posted by Throweck on 2016-02-19 10:54:09
Play some blood bowl and stop playing with marbles. Unless it's 'keepsies' then it requires 100% attention. I lost my favourite swirly when I was 7. It scarred me for life. I called it Brian. :)
Posted by stej on 2016-02-19 11:20:39
@Endzone. Indeed, i'll ultimately be using this to get the expected number of turns. Id then need to calculate the probability of getting 1,2,3...n turns in each situation then sum them up so i'll still need a formula to populate the table.
I'm thinking, using C and P functions might yield a workable form.
Thanks for the input all!
Posted by Endzone on 2016-02-19 11:51:42
In the simple example of R and B where R is a positive integer and B=1 your expectancy formula for R is given below

R=n, B=1

R E(R)
1 2/2 (n*(n+1)/2)+1)/(n+1)
2 4/3 (n*(n+1)/2)+1)/(n+1)
3 7/4 (n*(n+1)/2)+1)/(n+1)
4 11/5 (n*(n+1)/2)+1)/(n+1)
Posted by stej on 2016-02-19 22:43:25
OK, I think I may have cracked it for 3 colours in a general form which I'm happy with (may well be the same as Squiglets solution but I haven't checked)

Assuming r red marbles, b blue and g green and wanting n red before blue and green have shown i get

Using notation
0! = 1
x! = x(x-1)(x-2).....(1)
xCy = x! / ( y! (x - y)! )

Total Unique Combinations
T = (r+g+b)!/(r!b!g!)

k = 1 to g
i = 1 to b

for n = N
Tn = sum over k [ ((k+n)Cn)((r-n)+(g-k)+(b-1))C(r-n) ]
+
sum over i [ ((i+n)Cn)((r-n)+(b-i)+(g-1))C(r-n) ]

Gives the combinations

So probability = Tn / T

Anyone fancy validating this ;)
Posted by m0gw41 on 2016-02-20 00:24:47
I accidentally swallowed a red marble, what do I do next?
Posted by stej on 2016-02-20 00:54:42
I suspect you wait until it comes out and definately do not replace it in the jar
Posted by thoralf on 2016-02-20 00:58:18
Learn Kung Fu, m0gw41.