Dice Probability - looking for Maths Geniuses

Fedora.Pirate

First Post
Hey all, Sorry if this is in the wrong place and/or incorrectly formatted; but I'm I'm new so I hope you all can cut me a little slack. I am currently eneavouring to create a spreadsheet in excel to display the probability of any availible roll when you roll n dice of x sides. I've managed to get that working with rolls totaling up to 100.
My current endeavour is to set it up so that I may see the probabilities for a roll of n dice with x sides when keeping only the highest result. With the eventual goal of being able to roll n dice of x sides keeping the highest y results; and then maybe another where the dice explode (I've already got this working with a single dice).

However at preasent I'm stuck finding a formula for rolling n dice with x sides and keep the highest reasult. I've managed to get formula for n = 1 (probability = 1 / x) through to n = 5 as shown below; where v = a value found on a dice (so when rolling 2d6 and keeping the highest result, the odds of getting a 2 are 3/36 = 1/12)
n=2
v * 2 -1
n=3
(v * 2 -1) * (v -1) + v^2
n=4
(v * 2 -1) * ((v -1)^2 + v^2)
n=5
(v * 2 -1) * ((v -1)^2 + v^2) * (v - 1) + v^4

What i am currently trying to figure out and making no progress with is a unified formula/method so a new one doesn't have to be figured out for each new value of n. I'm sure one must exist as various patterns emerge throughout this experiment yet I cannot for the life of me see it.
Any help at all would be appreciated.

Furthermore, any advice on my future eneavours, or answers to the future questions that I am bound to ask will also be appreciated.
 

log in or register to remove this ad

I posted this in another thread some time ago, you'll have to relabel the variables:

If you roll a dN (N-sided die) n times and let X be the max of the n rolls, then the probability that X = k is:

p_k = (k^n - (k-1)^n)/N^n.

Thus, the expected value of X is:

E(X) = (N^(n+1) - 1^n - 2^n - 3^n - ... - (N-1)^n)/N^n.

For example, if N = 20 and n = 3, you'd get 15.4875, as was mentioned above.
 

Elric posted the following approximation, in case you're interested:

To add to this a bit: An approximation that makes for easy calculations is that if you roll a dN (N-sided die) n times, and let X be the max of the n rolls, for N fairly large, E(X) approximately= N*n/(n+1) + 1/2.

E.g., rolling 3 times averages 0.75*N + 1/2, and when we plug in N=20 we get E(X) approximately= 15.5, which is very close to the true value of 15.4875.
 

about 10 years ago, I was bored and wrote a program to get the answer on my little Compaq PC Companion that I had downloaded Basic onto.

My interest was "what's the average result from 4d6 keep the best 3"

Not being a math genius, I wrote the program quickly as a series of nested for loops that it then ground through all posibilities and added them up.

for normal dice rolls, the average of NdS (where N=number of dice, and S=number of sides) is N(S/2+.5). Hence 3d6 is 3(6/2+.5) = 10.5

the 4d6 keep the best three method required more complext math or some brute force combinations generation.

As I recall, the final answer was 12.5 or some such. I guess its ironic, the math majors in the house didn't think to actually infer what the most probable example question as it relates to D&D and use that as an example.
 

It's not a directly relevant answer to your question, but if you haven't seen it, there is the AnyDice Calculator site that might be of interest to you.

It doesn't give the fomulas, but it does show all the probablilities for pretty much any fistful of dice imaginable, along with nice little plots. It might be a nice comparison for whatever project yuo're working on.
 

Remove ads

Top