IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Open Test..., A "mathematical" problem
Gorath
post Feb 1 2004, 05:54 PM
Post #1


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



Hi,

Sometime ago we had a discussion about open rolls (like a stealth test) here on the dumpshock boards.

We developed a formula to calculate the expected value at an open roll.

I.e. for 1 die the expected value is E(1)=4.2
You get this from:
E(1)=1/6 + 2/6 + 3/6 + 4/6 + 5/6 + 1/6*(E(1)+6) ==> E(1)=21/5=4.2

You can continue this, if E(2) is the expected value rolling 2 dice you get:

E(2)= 1/36*(E(2)+6)+ 10/36*(E(1)+6)+1/36*95 ==> E(2)=29/5=5.8

If you rewrite using Binomial factors you get:

E(2) = B(2,2) * (1/6)^2 * (5/6)^0 * (E(2)+6) + B(2,1) * (1/6)^1 * (5/6)^1 * (E(1)+6) + (1/6)^2 * R(2)

with R(x):= (Sum from k=1 to 5) (k^x-(k-1)^x)*k


==>

E(x):=B(x,x)*(1/6)^x * (5/6)^0 * (E(x)+6) + B(x, x-1) * (1/6)^(x-1) * (5/6)^1 * (E(x-1)+6) + B(x, x-2) * (1/6)^(x-2) * (5/6)^2 * (E(x-2)+6) + ... +B(x,2) * (1/6)^2 * (5/6)^(x-2) * (E(2)+6) + B(x,1) * (1/6)^1 * (5/6)^(x-1) * (E(1)+6) + (1/6)^x * R(x)

My question is:

(a) Can someone remember this discussion and has a link to the post?

(b) Is anyone good in math and can give a expicite formula (insteed of this recursive one) to calculate E(x)?
Go to the top of the page
 
+Quote Post
Gorath
post Feb 1 2004, 05:59 PM
Post #2


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



*deleted*
Go to the top of the page
 
+Quote Post
Fonitrus
post Feb 2 2004, 01:28 AM
Post #3


Target
*

Group: Members
Posts: 42
Joined: 25-September 02
From: Sydney - NSW - Australia
Member No.: 3,321



QUOTE (Gorath)
*deleted*

da scroll, da scroll, da button, da button, scrolling so smooth like the butter on the muffin :)

go strongbad...
Go to the top of the page
 
+Quote Post
Gorath
post Feb 2 2004, 06:13 PM
Post #4


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



*bump*
Go to the top of the page
 
+Quote Post
Zazen
post Feb 2 2004, 06:17 PM
Post #5


Shooting Target
****

Group: Members
Posts: 1,685
Joined: 17-August 02
Member No.: 3,123



I remember starting that thread. I think its topic was "arithmetic mean of a shadowrun d6". If I remembered the URL to the old boards, I'd go find it.
Go to the top of the page
 
+Quote Post
Reaver
post Feb 2 2004, 06:19 PM
Post #6


Moving Target
**

Group: Members
Posts: 518
Joined: 24-February 03
From: Tucson
Member No.: 4,153



QUOTE (Zazen)
I remember starting that thread. I think its topic was "arithmetic mean of a shadowrun d6". If I remembered the URL to the old boards, I'd go find it.

I'd be inclined to help out, but I'm not an Algebra Shaman. ;)
Go to the top of the page
 
+Quote Post
Jason Farlander
post Feb 2 2004, 06:27 PM
Post #7


Running Target
***

Group: Members
Posts: 1,049
Joined: 24-March 03
Member No.: 4,323



QUOTE (Fonitrus)
QUOTE (Gorath @ Feb 2 2004, 04:59 AM)
*deleted*

da scroll, da scroll, da button, da button, scrolling so smooth like the butter on the muffin :)

go strongbad...

I keep the buttons on scroll and all the ladies in check; did you find the spare keys to my apartment yet? Word.

oh... and heres the thread.

(I'm decently good at math, but I'm not in a mathy mood right now. Maybe later.)
Go to the top of the page
 
+Quote Post
Daishi
post Feb 2 2004, 08:27 PM
Post #8


Moving Target
**

Group: Members
Posts: 224
Joined: 6-April 02
From: ab.ca
Member No.: 2,522



E(1) = 4.2, E(2) = 5.8, E(3) = 6.85116
E(4) = 7.64789, E(5) = 8.29710, E(6) = 8.84773
E(7) = 9.32640, E(8) = 9.74950, E(9) = 10.1281
E(10) = 10.4700, E(11) = 10.7811, E(12) = 11.0662
E(13) = 11.3288, E(14) = 11.5719, E(15) = 11.7981
E(16) = 12.0093, E(17) = 12.2074, E(18) = 12.3938
E(19) = 12.5698, E(20) = 12.7365, E(21) = 12.8948
E(22) = 13.0455, E(23) = 13.1893, E(24) = 13.3270

I believe that's the pertinent part stolen from what I read from the thread Jason dug up. I'd confirm it, but I'm still trying to figure how to avoid the infinite series. I'm not good at those.
Go to the top of the page
 
+Quote Post
Gorath
post Feb 2 2004, 08:28 PM
Post #9


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



Thanks! I did not remeber the thread and i find searching the old board a real pain...

But for all mathematical interessted: YOU MUST READ THE OLD DISCUSSION. And there are still problems to solve (i.e. "What Stealth skill is needed to beat a Perception Test with 50%, 70%, 95%?")
Go to the top of the page
 
+Quote Post
The White Dwarf
post Feb 2 2004, 10:53 PM
Post #10


Moving Target
**

Group: Members
Posts: 614
Joined: 17-June 03
From: A safehouse about to be compromised by ninjas
Member No.: 4,754



Calculating the specific percentile chances for success is easy if you simply provide the dice amounts and TNs of the equation, its simple algebra.

If youre trying to come up with a formula for an open test thats more difficult.

Simply put, if you are dealing with intelligence 6, presume they will get a single 6 at least 2/3rds of the time, which will then be a 10+ 1/3rd of the time. In otherwords intelligence 6 = 10+ on 1 in 3 rolls most of the time.

So to beat intelligence 6 npcs with an open stealth roll most of the time, you would need to be scoring 10+ over half the time, which would happen somewhere near 12 dice thrown.

Those are rough averages, which you could bank on as a gauge of you odds for success. Thing is, those odds are *most of the time* as in about 66% in your favor. If you want your margin of error to be closer to like failing 5% of the time you would need a lot of dice... At that point its best to go for something like Traceless Walk or Camoflauge... only when you run the math does the huge benefit of such things become really apparent.

Bottom line: improve dice for stealth up to 10ish if possible, because combined with camo or other bonuses you can beat most things most of the time.
Go to the top of the page
 
+Quote Post
Rev
post Feb 2 2004, 11:22 PM
Post #11


Moving Target
**

Group: Members
Posts: 675
Joined: 26-February 02
From: Seattle
Member No.: 2,034



An unmodified stealth roll like that would be something like sneaking around a 1/3 full parking lot in the middle of a clear day. Some cover, but no other modifiers.

A full parking lot should probably get some unusually good cover modifier, darkness or rain would bring visibility modifiers, distractions further modifiers, etc, etc.
Go to the top of the page
 
+Quote Post
gknoy
post Feb 3 2004, 06:26 AM
Post #12


Moving Target
**

Group: Members
Posts: 413
Joined: 20-November 03
Member No.: 5,835



QUOTE (Gorath)
(b) Is anyone good in math and can give a explicit formula (instead of this recursive one) to calculate E(x)?

Often, a recursive definition is Simpler and More Elegant. Usually, if someone chooses to express it recursively, it is because it's simplerthat way. In this case [and having not read the Old Thread, so I can be wrong :)], I expect that there might not _be_ a simple Plug In The Numbers Here type equation.

Besides, it might not be that bad to write a program to calculate it.
If I can find out how to express B(a, b), (since I've had trouble digging that up online) I might be able to write code for it ...

Remember, just because we don't like equations that are super-super-extremely-long, doesn't mean that Perl might not. ;-D (When in doubt, use the big hammer. You'd be surprised how well it can work. [yes, I'm stealing and badly paraphrasign Donald Knuth. :)])

heck, if I were crazy [and I might be ;)], I might start working on implementing that ... :)


On a side note - How can I access the Old Forums? I thought there was a link on the main forums page but I can't seem to find it.

This post has been edited by gknoy: Feb 3 2004, 06:31 AM
Go to the top of the page
 
+Quote Post
Zazen
post Feb 3 2004, 06:34 AM
Post #13


Shooting Target
****

Group: Members
Posts: 1,685
Joined: 17-August 02
Member No.: 3,123



It appears that the old forums are at http://jive.dumpshock.com/default/. For some reason http://jive.dumpshock.com/ by itself redirects to the new forums.
Go to the top of the page
 
+Quote Post
Gorath
post Feb 3 2004, 07:19 AM
Post #14


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



QUOTE (gknoy @ Feb 3 2004, 06:26 AM)

Often, a recursive definition is Simpler and More Elegant.  Usually, if someone chooses to express it recursively, it is because it's simplerthat way.  In this case [and having not read the Old Thread, so I can be wrong :)], I expect that there might not _be_ a simple Plug In The Numbers Here type equation.

Besides, it might not be that bad to write a program to calculate it.
If I can find out how to express B(a, b), (since I've had trouble digging that up online) I might be able to write code for it ...
]



I don't think this recursive definition is more simpler, because you need to know all E(1), E(2),..., E(k) to get a not so simple equation for E(k+1). If you have a explicite formula, you have something like E(k)=f(k) where f is a function.


B(n,k) gives the number of possibile solution to choose k elements out of n given.
B(n,k)=Binomial(n,k) := n! / ((n-k)! k!)
i.e. B(5,3)=5! /(2! * 3!) = 120 / (2 * 6) = 10
Go to the top of the page
 
+Quote Post
Daishi
post Feb 3 2004, 08:38 AM
Post #15


Moving Target
**

Group: Members
Posts: 224
Joined: 6-April 02
From: ab.ca
Member No.: 2,522



QUOTE (gknoy)
Often, a recursive definition is Simpler and More Elegant. Usually, if someone chooses to express it recursively, it is because it's simplerthat way...

Besides, it might not be that bad to write a program to calculate it.
If I can find out how to express B(a, b), (since I've had trouble digging that up online) I might be able to write code for it ...

I was going to build a quick little app to handle the calc, but I found a slight flaw in using a recursive algorithm to calculate the open test result: there is no base case! It's an open test. It does not end. There are dirty tricks I could use, but I didn't feel like coding if I couldn't do it right. An elegant solution to an infinite series is beyond my ken, and I'm lacking access to Matlab or Mathematica right now, which are probably my preferred solutions at this point.
Go to the top of the page
 
+Quote Post
The White Dwarf
post Feb 3 2004, 09:49 AM
Post #16


Moving Target
**

Group: Members
Posts: 614
Joined: 17-June 03
From: A safehouse about to be compromised by ninjas
Member No.: 4,754



Yea, it *is* an unlimited situation, which is why I tossed out some solid averages to go off of. And as Rev pointed out, theyre using pretty base numbers which means if youre using camo and some terrain to your advantage (as mentioned) while throwing 10ish dice at the test, youre pretty much good to go, unordinary circumstances aside. Like, dont try to stealth past the sensor 3 drone, m'kay? Or sneak past the thermal vision guards holding a recently fired gun. Etc.
In the end, 10-12 dice and some basic mods + common sense = stealthy runner.
Go to the top of the page
 
+Quote Post
Gorath
post Feb 3 2004, 10:01 AM
Post #17


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



How can you define a recursive function in Mathematica?

And how can i define a recursive function (in Mathematica) that depends of all values before?
Go to the top of the page
 
+Quote Post
gknoy
post Feb 3 2004, 11:21 PM
Post #18


Moving Target
**

Group: Members
Posts: 413
Joined: 20-November 03
Member No.: 5,835



QUOTE (Gorath)
I don't think this recursive definition is more simpler, because you need to know all E(1), E(2),..., E(k) to get a not so simple equation for E(k+1). If you have a explicite formula, you have something like E(k)=f(k) where f is a function.


B(n,k) gives the number of possibile solution to choose k elements out of n given.
B(n,k)=Binomial(n,k) := n! / ((n-k)! k!)
i.e. B(5,3)=5! /(2! * 3!) = 120 / (2 * 6) = 10

THANK you for the B(n,k) formula. =)

The recursive definition does NOT include all previous ones.

Rather, E(x) needs E(x-1) and E(x-2) --- unless I misread the original post.
Yes, you do need to eventually calculate all of the E() 1..k ... that's true. But you can implement it relatively easily.


Regarding it being open, and having no cap: That sounds like it's true... but the definition of E(x) that Gorath originally gave us might account for that. Remember that we aren't really rolling dice, but saying what we *expect* to get. And by expect, I mean have any reasonable probability of happening... recall that the likelihood of rolling high decreases rather fast.
Go to the top of the page
 
+Quote Post
Gorath
post Feb 4 2004, 07:45 AM
Post #19


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



You need E(1) ... E(k-1) to calculate E(k)!

I think, if you simulate the open roll, it would be interessting to see the complete propabilities for each outcome.

So you can get:

1. the expected value
2. and know how narrow the distribution is

So for x d6 make 10^12 open rolls and remember the results. Then make a diagramm for the results from 1 to highest roll. So you can see the distribution and the "expected" value. Perhaps someone can write a programm to do this and show us the distributions ;-)
Go to the top of the page
 
+Quote Post
kenji
post Feb 4 2004, 10:33 AM
Post #20


Target
*

Group: Members
Posts: 56
Joined: 21-July 03
From: the Worcester Barrens
Member No.: 4,997



blah blah blah deleted.

something like:

E.V. = Limit ( n->infinity; Sigma{ i=1..n; i*P(i) } )
P(i) = 1/6^(floor([i-.5]/6)+1)

---
edit: i apologise for my 1 dimensional waste, as Quujquux has answered the question fully, and algebraically.
Go to the top of the page
 
+Quote Post
gknoy
post Feb 4 2004, 12:24 PM
Post #21


Moving Target
**

Group: Members
Posts: 413
Joined: 20-November 03
Member No.: 5,835



Gorath - if you are doing the calculations by hand, you should just shoot yourself. ;)

If you are doing it with a computer, then don't worry about it -- we aren't recursing far enough to cause any memory issues.

Incidentally - I have tried to implement the recursive definition that Quujquux (sp? did I misplace some letters?) posted in the Old Forum; Unlike yours, it was explicitly recursive...

I got WILDLY different numbers, way different from the ones he posted as his calculated values, and obviously wrong. ;) Which confuses me: Either I made a mistake in implementing his forumla (which I doubt, as the formula was relatively simple), or he made a typo in giving it to us. (As for the previous ones he gave us, I don't see how they would work, since the definition for E(x) in his post includes E(x) in its definition; sounds circular.)

The interesting thing is, I KNOW that Quu[etc] was on to something correct. I wrote some brute-force roll-a-bunch-of-dice code (REALLY easy!), and ran it for 100,000 iterations for each number of dice to use in an open test. (So, I did 800,000 open tests). This took about two to three minutes on my old P2 at work, and the numbers I got were VERY close (like, within 0.1) to what Quujquux posted. I was impressed with his math -- expected values don't need 5 digits of precision anyways, but I do love the elegance of an exact answer.

So, now I'm curious - what WAS his original formula, really? (Or did I mis-implement it - doubtful, since it's just a big math expression with a summation inside -- ?)

If anyone's interested, I can post code for this on the web (no, I won't clutter this board unnecessarily :)).
Go to the top of the page
 
+Quote Post
Gorath
post Feb 4 2004, 05:42 PM
Post #22


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



Hmm, as far as i see, the last formula that Quu[etc] gave is correct. (He has a small typo in the formula for f(n), but the last result for E(n) is correct...

Go to the top of the page
 
+Quote Post
gknoy
post Feb 4 2004, 11:40 PM
Post #23


Moving Target
**

Group: Members
Posts: 413
Joined: 20-November 03
Member No.: 5,835



That's what I thought too... (BTW guys, this is going to be a relatively long post. Apologies ahead of time. :))

For reference, a copy of my script can be seen at
http://www.anasazisystems.com/~gknoy/perl_...penTest.pl.html

I used:
CODE
E(n) = 1/(6^n - 1) * (6^(n+1) - 5^n - 4^n - 3^n - 2^n - 1)
        + Sum i=1..n-1 of E(i)*(n choose i)*5^(n-i)

(from The Old Forum)

When I run my code that implements it, though I get
E(1) = 3.5
E(2) = 39.4722222222222
E(3) = 859.541666666667
E(4) = 24866.9112654321
E(5) = 896841.407021605
E(6) = 38814870.7454775
E(7) = 1959930608.26011
E(8) = 113103327463.866
E(9) = 7342812502005.06

.. which leads me to think there's a bug in my code. But I can't find it, as yet. O_o

However, when I run my empirical test (with a bit under a million open tests rolled), I get:
E(1) = 4.20127
E(2) = 5.81023
E(3) = 6.85598
E(4) = 7.65706
E(5) = 8.30353
E(6) = 8.84027
E(7) = 9.30096
E(8) = 9.76566

Further investigation, following the formula by hand, yeilds:

CODE
E(1) = 1/(6-1) * (6^2 - 5 - 4 - 3 - 2 - 1) + sum( 1..0 ) [nothing]
       = 1/5 * (36 - 15) = (21)/5
       = 4.2

E(2) = 1/(6^2 - 1) * (6^3 - 25 - 16 - 9 - 4 - 1) + ( E(1) * (2 choose 1) * 5^1 )
       = 1/35 * (216 - 55) + (4.2 * (2) * 5)
       = 1/35 * (161) + 42


This is what I implemented, and now I see why I was getting crazy numbers: the 42 (and therefore the summation) needs to be inside the term that is multiplied by 1/(6^n - 1).

Looking back at Quujquux's post, I just now noticed that his original description of E(n) has the summation there, and the parenthesis probably just migrated. It should read:

CODE
E(n) = 1/(6^n - 1)
       * ( 6^(n+1) - 5^n - 4^n - 3^n - 2^n - 1
            + Sum i=1..n-1 of E(i)*(n choose i)*5^(n-i) )


Having fixed my program to match, I get numbers that are pretty much what Quujquux posted. In order to have an average open-test roll of 10 or better, you need to be rolling 9 dice. 13's start at 22 dice, 14's at 30 dice, 15s at 41 dice. 16's start being average when you are rolling 55 dice: Good luck on that one. ;)

So, you can expect stealthy starting characters to be rolling probably 9's (or 11s if they're an adept ;)).

This post has been edited by gknoy: Feb 4 2004, 11:46 PM
Go to the top of the page
 
+Quote Post
Gorath
post Feb 5 2004, 10:56 AM
Post #24


Moving Target
**

Group: Members
Posts: 128
Joined: 19-March 03
Member No.: 4,292



The interessting point is, how narrow are those expected values?

Sure, mathematical you need a INT9 to beat a Stealth9 guy (with no mods to TNs). BUT sometimes a INT4 guard will roll lucky and get high numbers too. So how is the propability for a Stealth9 runner to sneak past a Int4 guard?

If you work brute force you just need to make a open roll with x d6s versus a open roll with y d6s and check who got the hightes roll. Do this 10^6 times for 0<x,y<24 and post your results ;-)

The propability to beat guard with INT x with Stealth y is p(x,y).

IF someone is able to write a programm to calculate this, and post the results, i would be very glad :D


EDIT: If you got this, you can calculate p(x,y,m) there m is the modifation to the TN of the guard. -24<m<24 :rotfl:
Go to the top of the page
 
+Quote Post
gknoy
post Feb 5 2004, 11:27 AM
Post #25


Moving Target
**

Group: Members
Posts: 413
Joined: 20-November 03
Member No.: 5,835



hehe ... :)

The expected values andthe experimentally determined values are almost always within .1 ... which for our use is probably Just Fine.

The distribution of open roll results, now THAT is interesting -- I imagine I'd end up rolling a bunch of times, and having counting-buckets of which results turn up.

I was going to disagree with you on the int X needed to beat stealth-X boy -- but then I realized, the open test probability is the same as a success test that will get at least one success... I think. The mechanics are the same, but the expected value ... would that be the same? I'm curious, but I am pretty sure they're the same.

p(x,y) should be not-that-hard to compute ... find E(y), and then find the probability that x dice will beat E(y). Those should be storeable in a 42x42 array . . . *winks* In fact, p(x,y,m) should simply alter what the indices are to look it up, right?

I'm curious, too ... I wonder what the best method is (perhaps including the simple brute-force method ;)) to calculate those probabilities of n dice beating some target? As an aside, I'd consider P(n, t) to represent the probability of beating TN t with n dice. But that could be confusing when paired with your preemptive definition of p(x,y). ;) Though, I believe that p(x,y) = 1 - P(x, E(y)), right? Or would it be more complicated?
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic

 



RSS Lo-Fi Version Time is now: 16th September 2024 - 12:38 PM

Topps, Inc has sole ownership of the names, logo, artwork, marks, photographs, sounds, audio, video and/or any proprietary material used in connection with the game Shadowrun. Topps, Inc has granted permission to the Dumpshock Forums to use such names, logos, artwork, marks and/or any proprietary materials for promotional and informational purposes on its website but does not endorse, and is not affiliated with the Dumpshock Forums in any official capacity whatsoever.