|
|
|
|
 |

May 11th, 2008, 11:19 AM
|
 |
General
|
|
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
|
|
Re: Maths problem: fatigue vs critical hits
Quote:
lch said:
Now with two dice, I'm not sure but I think it goes like this: You want a combination of two rolls that add up to X, so X = Y+(X-Y) and 0 < Y < X. Your probability is given as follows: For every Y from 1 to X-1, multiply P(Y) and P(X-Y) as given above. Add all of them together, divide by X-1. That's your probability for two rolls. You can simplify it into a closed form, which could be kinda tricky because of the modulo representation for Y and X-Y. Maple helps.
|
Okay, the second part was pretty bogus. It shows that I never really learned probability calculus. Another try:
X = 6a + b, 0 <= b < 6. Then the probability that a DRN gives X or higher on a roll is P(">= X") = (7-b)(1/6)^(a+1).
The probability that it equals X is P("= X") = (1/6)^(a+1).
But measuring a two-die roll isn't as easy. Here's a small python program that I used to check cleveland's calculations:
Code:
#!/usr/bin/env python
def p_1(x):
if x < 1:
return 1
b = x % 6
a = (x-b)/6
return (7-b)*pow((float(1)/6), a+1)
def p_2(x):
if x < 1:
return 0
b = x % 6
a = (x-b)/6
return pow((float(1)/6), a+1)
def doubledrn(x):
M = [(a,b) for a in range(1,x-1) for b in range(1,x-a)]
s = 0.0
for (x_1, x_2) in M:
s += p_2(x_1)*p_2(x_2)
return 1-s
def doubledrn_2(x):
s = p_1(x)
for y in range(1,x-1):
s += p_2(y)*p_1(x-y)
return s
for x in range(2,18):
print ">= %2d : %f" % (x, doubledrn(x))
And here's the output of it: Code:
>= 2 : 1.000000
>= 3 : 0.972222
>= 4 : 0.916667
>= 5 : 0.833333
>= 6 : 0.722222
>= 7 : 0.583333
>= 8 : 0.462963
>= 9 : 0.361111
>= 10 : 0.277778
>= 11 : 0.212963
>= 12 : 0.166667
>= 13 : 0.119599
>= 14 : 0.079475
>= 15 : 0.046296
>= 16 : 0.020062
>= 17 : 0.000772
So as far as I can tell, cleveland's table is right. The difference in later numbers probably comes from rounding precision being a ***** again, as my code probably isn't numerically stable. If I'd calculate greater values, the numbers even turn negative! I'd be interested what formulas cleveland used to be able to trick the rounding precision.
|

May 11th, 2008, 06:16 PM
|
 |
Captain
|
|
Join Date: Oct 2007
Location: guess - and you'll be wrong
Posts: 834
Thanks: 33
Thanked 187 Times in 66 Posts
|
|
Re: Maths problem: fatigue vs critical hits
Quote:
lch said:
If I'd calculate greater values, the numbers even turn negative!
|
Negative probabilities? Sounds like my odds the last time I was in Vegas.
Here's roughly what I did:
1) Constructed a vector A(i) of the explicit probabilities for each single drn outcome i. This is pretty straightforward:
A(1)=A(2)=...=A(5)=1/6
A(6)=A(7)=...=A(10)=(1/6)^2
Etc.
2) Constructed a vector B(j) of the probabilities a second drn would be less than or equal to j. So:
B(1)=A(1)
B(2)=A(1)+A(2)
B(3)=A(1)+A(2)+A(3)
Etc.
3) Constructed a matrix M such that M(i,j) = A(i)*B(j). Therefore, each M(i,j) = P(X<=i+j | drn1=i).
4) Summing the / diagonals of this matrix (i.e. all M(i,j) whose i+j are identical) gives the probability that the 2d6oe will be less than or equal to i+j.
So for example, lets take the case when we want the 2d6oe <= 3. This is only possible 2 ways: if drn1=1 & drn2<=2, or if drn1=2 & drn2=1.
We therefore have:
A(1)=1/6
A(2)=1/6
B(1)=1/6
B(2)=2/6
M(1,2)=(1/6)*(1/6)
M(2,1)=(1/6)*(2/6)
So M(1,2)+M(2,1)= 0.083
Of course, this summation becomes larger for larger X=i+j.
When X=7, you'll need to add M(1,6)+M(2,5)+M(3,4)+...+M(6,1).
Phew.
|

May 11th, 2008, 06:59 PM
|
 |
Colonel
|
|
Join Date: Oct 2007
Location: in a sleepy daze
Posts: 1,678
Thanks: 116
Thanked 57 Times in 33 Posts
|
|
Re: Maths problem: fatigue vs critical hits
And now in English? 
__________________
i crossed blades with the mightiest warriors of the golden age. i witnessed with sorrow the schism that led to the passing of legends. now my sword hangs in its scabbard, with nothing but memories to keep it warm.
|

May 11th, 2008, 07:30 PM
|
 |
Captain
|
|
Join Date: Oct 2007
Location: guess - and you'll be wrong
Posts: 834
Thanks: 33
Thanked 187 Times in 66 Posts
|
|
Re: Maths problem: fatigue vs critical hits
Quote:
DonCorazon said:
And now in English?
|
English? I didn't do very well in English... 
|

May 11th, 2008, 09:23 PM
|
 |
General
|
|
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
|
|
Re: Maths problem: fatigue vs critical hits
Quote:
cleveland said:
Here's roughly what I did:
1) Constructed a vector A(i) of the explicit probabilities for each single drn outcome i. This is pretty straightforward:
A(1)=A(2)=...=A(5)=1/6
A(6)=A(7)=...=A(10)=(1/6)^2
Etc.
|
I think this is already where I fail, because the rest is pretty much the same. I was jumping back and forth between modulo 5 and modulo 6 just because the whole thing is offset by 1 and the gaps didn't work out. Let's correct this now...
Let X-1 = 5a + b, 0 <= b < 5. (notice the -1!!) Then the probability that a DRN gives exactly X is p(DRN = X) = (1/6)^(a+1).
The probability that it is X or greater is:
Now, we have two ways of measuring all the (x,y) in IN x IN which sum is equal to or greater than X: Either we take all the (x,y) with x+y < X and subtract the probability of them showing up simultaneously from 1, thus inverting the set, like you did if I understood right, or measure the following (with a loose mathematical notation): Code:
(1, >= X-1)
(2, >= X-2)
(3, >= X-3)
... etc.
(X-1, >= 1)
(>= X, *)
which should be equal to {(x,y) | x+y >= X}. I implemented both versions in Python again: Code:
#!/usr/bin/env python
# p(DRN) >= x
def p_1(x):
if x < 1:
return 1
b = (x-1) % 5
a = (x-1) / 5
return (6-b)*pow((float(1)/6), a+1)
# p(DRN) == x
def p_2(x):
if x < 1:
return 0
b = (x-1) % 5
a = (x-1) / 5
return pow((float(1)/6), a+1)
# p(2d6oe) >= x
def doubledrn(x):
M = [(a,b) for a in range(1,x-1) for b in range(1,x-a)]
s = 0.0
for (x_1, x_2) in M:
s += p_2(x_1)*p_2(x_2)
return 1-s
# p(2d6oe) >= x (alternate version)
def doubledrn_2(x):
s = p_1(x)
for y in range(1,x):
s += p_2(y)*p_1(x-y)
return s
for x in range(2,20):
print ">= %2d : %f" % (x, doubledrn(x))
print ">= %2d : %f" % (x, doubledrn_2(x))
and huzzah, they both give the same result, and it is: Code:
>= 2 : 1.000000
>= 3 : 0.972222
>= 4 : 0.916667
>= 5 : 0.833333
>= 6 : 0.722222
>= 7 : 0.583333
>= 8 : 0.462963
>= 9 : 0.361111
>= 10 : 0.277778
>= 11 : 0.212963
>= 12 : 0.166667
>= 13 : 0.127315
>= 14 : 0.094907
>= 15 : 0.069444
>= 16 : 0.050926
>= 17 : 0.039352
>= 18 : 0.029578
>= 19 : 0.021605

|

May 11th, 2008, 10:30 PM
|
 |
General
|
|
Join Date: Feb 2007
Location: R'lyeh
Posts: 3,861
Thanks: 144
Thanked 403 Times in 176 Posts
|
|
Re: Maths problem: fatigue vs critical hits
Quote:
lch said:
The probability that it is X or greater is: (...) (6-b)(1/6)^(a+1)
|
I just noticed that it is way easier to get the same result in a different way than I did. We already know that each element in a modulo "layer" shares the same probability, and that all the following layers together are cramped into something having the same probability, too. So you just need to count from the current element to the end and sum up.
|

May 25th, 2008, 07:48 PM
|
|
Private
|
|
Join Date: May 2008
Location: Germany
Posts: 5
Thanks: 0
Thanked 4 Times in 3 Posts
|
|
Re: Maths problem: fatigue vs critical hits
I don't know if you are still interested in this, but I was, as it says "maths problem" in the title  For future reference, if nothing else, the actual probability distributions for 1d6oe and 2d6oe (=DRN in the manual) are:

and for the original question,

In all expressions X=5n+r, with 1<=r<=5 (note limits!).
The first one is more or less trivial, the second is proven by induction in n and the third follows from that by straightforward summation.
|
|
The Following User Says Thank You to Pehmyt For This Useful Post:
|
|

May 25th, 2008, 07:56 PM
|
 |
Sergeant
|
|
Join Date: Dec 2007
Location: Staring through your window
Posts: 333
Thanks: 26
Thanked 4 Times in 4 Posts
|
|
Re: Maths problem: fatigue vs critical hits

I started reading all of this and thought of this picture...

__________________
I can has Backrub?
|

May 25th, 2008, 09:32 PM
|
 |
Second Lieutenant
|
|
Join Date: Mar 2008
Posts: 448
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
Re: Maths problem: fatigue vs critical hits
So that is what kids are learning in school these days. 
|
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|