# 5D6 drop the lowest two (math ?)



## Sabathius42 (Jul 11, 2003)

Ok folks, and more specifially statistics guys and gals, heres the scoop.

I am running a Forgotten Realms campaign in which I want the PC's to be extra heroic with their stat rolls.  So, with that idea in mind, I decided to throw them an extra bonus in character creation and roll 5D6 instead of 4, and drop the lowest two dice to determine their stats.  I have run this through a giant number mill and determined the average score is 13.4.

I am also offering the option to instead take a base score of 8 in each stat, and add 33 points, which also would give you an average score of a 13.4.

My question to you, the reader, is this...

I know how to find the average stat by brute force, but I have become interested in finding out how to determine the average by an actual formula or proper math, not just repetition.  Does anyone know how to figure this out, or else where I could find some information on the web helping me out?

Thanks ahead of time
DS


----------



## theoremtank (Jul 11, 2003)

This is a very good question and one I have pursued also.  I too am able to calculate the average by numerical methods but I have yet to solve the problem using any symbolic mathematical methods or equations.

I believe this is a combinatorics problem where we need to figure out the pattern for how many ways we can roll up each possible ability score.  As soon as you introduce dropping the lowest dice you introduce a decision in the process which I believe is what complicates things.

If anyone has figured this out yet I would love to hear your solution.

Heres a link to an excel spreadsheet a friend of mine whipped up for the 4d6 drop the lowest average.
http://www.members.cox.net/theoremtank1/maps/4d6 drop lowest average.xls


----------



## Ycore Rixle (Jul 11, 2003)

I would also like to see the math on this one.


----------



## HellHound (Jul 11, 2003)

Ask Charles Greathouse about the math.

He posted an analysis of all our standard character creation methods on another forum a few days ago...

From the various point-buys, to 4d6 drop lowest, 5d6 drop 2, 3d6+1d8 drop lowest, etc.

---

Hound Post #1968 - The year of 2001: A Space Odyssey. _'I'm sorry, Dave. I'm afraid I can't do that.'_


----------



## Winternight (Jul 11, 2003)

Can some nice person please link this threat?

Thanx in advance


----------



## Drawmack (Jul 11, 2003)

I've had this discussion a couple of times. One of the threads on this board yielded a formula for finding the % chance of rolling any given number when roll any combination of any dice. 

This could easily be extrpolated upon to get the average roll.

Could some nice comunity support use their search abilities to find this thread for this nice gentleman please?


----------



## Tabarnak Smokeblower (Jul 11, 2003)

The general way to calculate an average is thus:

You take the sum of ((sum of dice) * (chance of getting that sum))

Of course you have to calculate the probability of getting every possible combination (3 to 18), which can get a little complicated with drop-die methods. The spreadsheet posted by theoremtank can easily be adapted for 5d6, I think.

I'll try to whip up something at lunch, if the answers haven't been posted yet.

TS, who's trying desperately to remember stuff from his stats degree...


----------



## Tabarnak Smokeblower (Jul 11, 2003)

Ok it's not lunch yet but I'm bored out of my mind at work.

Here's the lowdown on 5d6 drop 2 lowest.

It's not elegant, and I haven't found an easy mathematical formula to calculate these things in the future.

See the attached excel file for results... (the excel file is too big dang it! Had to zip it)

TS


----------



## theoremtank (Jul 11, 2003)

Tabarnak Smokeblower said:
			
		

> *Ok it's not lunch yet but I'm bored out of my mind at work.
> 
> Here's the lowdown on 5d6 drop 2 lowest.
> 
> ...




Thanks for the work Tabarnak.  Do you have any insight on a method for counting (combinatorally) the different ways each ability score can come up.  This is the tricky part as you already noted.  I imagine if we solved a simpler problem first such as 2d6, 3d6 or 4d6 (drop the lowest) we might be able to generalize the formula.


----------



## Tabarnak Smokeblower (Jul 11, 2003)

theoremtank said:
			
		

> *
> 
> Thanks for the work Tabarnak.  Do you have any insight on a method for counting (combinatorally) the different ways each ability score can come up.  This is the tricky part as you already noted.  I imagine if we solved a simpler problem first such as 2d6, 3d6 or 4d6 (drop the lowest) we might be able to generalize the formula. *




I'll try to do some research during the week-end  But i'm pretty sure there's no "simple" way of finding the answer... the "drop lowest" is what makes it a little more complicated.

Have a good one!

TS


----------



## Nathan (Jul 11, 2003)

*Analytical solution*

An approach to an analytic solution:

Let us assume we have n dice with d sides each, numbered from 1...d. (In your case n = 5, d = 6). We want to drop the lowest k dice (k = 2 in your case).

How many ways are there to roll these dice? In total, there are n^d = n * ... * n (d times) outcomes

What we do now is to add up the totals (highest n - k) of all the n^d outcomes. Afterwards, we have to divide by n^d to get the average.

To be able to do this summation, let us first classify all the outcomes.

First of all, we classify them by a number l which shall be the highest number of the outcome that is to be dropped.

This way, we get n classes as l can run from 1 to d. In the example 5d6, drop lowest two, we have for example:

l(1 2 5 3 2) = 2, l(6 6 6 6 6) = 6, etc.

We now subdivide this classification further by the number r of dice that are lower than l. We see that r can run from 0 to n - 1. In our examples:

r(1 2 5 3 2) = 1, r(6 6 6 6 6) = 0.

Now, all the outcomes are classified by a pair (l, r). This classification is still too coarse. We introduce another number u, the number of dice that show l. u can run from 1 to n - r. Examples:

u(1 2 5 3 2) = 2, u(6 6 6 6 6) = 5.

Our outcomes are now classified by triples (l, r, u). This is fine enough to proceed.

Our summation would be now as follows: we sum over all possible classes given by a triple (l, r, u) the sum S(l, r, u) of all totals of all outcomes belonging to the class (l, r, u).

So let us fix (l, r, u), l = 1...d, r = 0...n-1, and u = 1...n-r.

What is the sum S(l, r, u)? To answer this, let us take a look at how an outcome belonging to the class (l, r, u) looks like.

It looks like:

A A A A B B B B B C C C C C C

where the A are dice lower than l, the B mark the dice that show l and the C are dice higher than l. We have r times A, u times B, and therefore n - u - r times C. However, we have been a little bit inexact here! The dice usually don't come sorted this way when they are rolled one after the other! But our row as given above is sorted: at the beginning all the dice lower than l, at the end all the dice higher. Anyway, the total doesn't depend on the sort order, so we can work with sorted outcomes like the one above. However, then, we have to take the number of outcomes that can be sorted into something like the above into account.

Let us define the binomial coefficient

(a over b)

by

(a over b) := 1*2*3*4*5*...*a/(1*2*3*...*b*1*2*...*(a-b))

Combinatorics tell us that the number of outcomes of class (l, r, u) that can be sorted as above is given by (n over r) * ((n - r) over u). Let us call this number M1(r, u), the M standing for multiplicity.

All the r dice below l don't count for the total so let us neglect them. However, this introduces another multiplicity in our formula: each set of all sorted outcomes of class (l, r, u) differing only in the lowest r dice consists of (l-1)^r members all leading the same total. Let us denote this number my M2(l, r).

So, now we have to deal only with rows like:

B B B B C C C C C C C,

where the number of B's is l, the number of C's being n - u - r.

What is the total T(l, u, r) of all these rows? The dice B contribute l * (u - (k - r)) to the total as (k - r) dice showing l shall be dropped. The dice C contribute anything from l + 1 to d to the total. Recall that there are (n - u - r) dice of type C.

By the Gaußian summation formula, we have

T(l, u, r) = l * (u - (k - r)) + (n - u - r) * ((d + 1) * d / 2 - (l + 1) * l / 2).

Now, let us throw everything together:

The average is

1/n^d * [the sum over l = 1...r of the sum over r = 0...k-1 of the sum over u = 1..n - r of (n over r) * ((n - r) over u) * (l - 1)^r * (l*(u - (k - r)) + (n - u - r) * ((d + 1) * d / 2 - (l + 1) * l / 2)].

I haven't checked the formula by explicit calculations but it should work if I haven't forgotten anything in the deduction and haven't made any typing errors.

Maybe someone has time to check the formula.

Nathan


----------



## Tabarnak Smokeblower (Jul 11, 2003)

*Re: Analytical solution*



			
				Nathan said:
			
		

> *
> Maybe someone has time to check the formula.
> 
> Nathan *




You bastard, you almost made my head explose!

Seriously, I'll try to read and understand that this week-end. Did I notice Pascal's triangle in there?

TS


----------



## dcollins (Jul 11, 2003)

*Re: Analytical solution*



			
				Nathan said:
			
		

> *The average is
> 
> 1/n^d * [the sum over l = 1...r of the sum over r = 0...k-1 of the sum over u = 1..n - r of (n over r) * ((n - r) over u) * (l - 1)^r * (l*(u - (k - r)) + (n - u - r) * ((d + 1) * d / 2 - (l + 1) * l / 2)].
> *




Err... if the answer invloves a "summation of a summation of a summation",  it seems like you may have just re-created the need to individually count each possible result.

Moreover, the thing we really need isn't just an average, what would be ideal is a mass probability function so people can evaluate the likelihood of different results. (People have been asking for this for years and I've never seen such a formula to date.)


----------



## Nathan (Jul 11, 2003)

*Re: Re: Analytical solution*



			
				dcollins said:
			
		

> *
> 
> Err... if the answer invloves a "summation of a summation of a summation",  it seems like you may have just re-created the need to individually count each possible result.
> 
> *




No, I haven't. In my formula, there are always only three summations, independent of the numbers n, k, and d. And this isn't bad, and quite normal for an analytic formula calculating an average.

However, just counting each possible result would lead to a growing number of summations if n, k, and d grow.



> *
> 
> Moreover, the thing we really need isn't just an average, what would be ideal is a mass probability function so people can evaluate the likelihood of different results. (People have been asking for this for years and I've never seen such a formula to date.) *




So you are asking for the likelihood of a certain result? There should be no problem to get such a formula if you follow the deduction steps of my formula above.


----------



## MeanGenes (Jul 11, 2003)

I'm going to attempt this the idiot way.


3d6 has an average of 10.5 (Assume a perfect distribution of 1, 3.5, and 6.  1+ 3.5 + 6 = 10.5)

4d6 has an average of 13 (Assume a perfect distribution of 1, 2.67, 4.33, and 6.  Drop the 1.  2.67 + 4.33 + 6 = 13)

5d6: Assume a perfect distribution of 1, 2.25, 3.5, 4.75, and 6.  Drop the 1 and 2.25 and you get 3.5 + 4.75 + 6 = 14.25

6d6: Assume a perfectly balanced roll 1,2,3,4,5,6.  Drop the 1,2, and 3.  4 + 5+ 6 = 15.

I'm not going to bother with 7d6.


----------



## Nathan (Jul 11, 2003)

MeanGenes said:
			
		

> *I'm going to attempt this the idiot way.
> 
> 
> 3d6 has an average of 10.5 (Assume a perfect distribution of 1, 3.5, and 6.  1+ 3.5 + 6 = 10.5)
> ...




Your method won't lead to the correct results but should give a good approximation.

With respect to my last comment on how to get a formula for the likelihood of a certain total N:

First you have to find a formula for C(l, r, u), the number of ways to add up n - u - r numbers from 1...d to N - (n - k) * l.

Then the likelihood of an outcome N should be:

1/n^d * [the sum over l = 1...r of the sum over r = 0...k-1 of the sum over u = 1..n - r of (n over r) * ((n - r) over u) * (l - 1)^r * C(l, r, u)].


----------



## MeanGenes (Jul 11, 2003)

Just curious...why won't my method work?  I'm not a math major or anything, but it seems to me that if you assume that all your rolls will eventually average out to a "perfect distribution" (1, 2.25, 3.5, 4.25, and 6), then couldn't you just use that as a shortcut rather than going through all the math and adding up all the possibilities?  My method works for 3d6 and 4d6, why not 5d6 and so on?

I'll be curious to see what results you get with your method and how close my method is.


----------



## Nathan (Jul 11, 2003)

MeanGenes said:
			
		

> *Just curious...why won't my method work?  I'm not a math major or anything, but it seems to me that if you assume that all your rolls will eventually average out to a "perfect distribution" (1, 2.25, 3.5, 4.25, and 6), then couldn't you just use that as a shortcut rather than going through all the math and adding up all the possibilities?  My method works for 3d6 and 4d6, why not 5d6 and so on?
> 
> I'll be curious to see what results you get with your method and how close my method is. *




I don't have a programme to hack my formula into at the moment, so I still hope that someone else will be doing this.

The initial poster mentioned that he calculated an average of 13.4 by brute force for 5d6, drop lowest 2. As your method gives a 13 here, we see that your formula can only be an approximation.

I can also give you an easy example: Let us assume we are throwing 2d2, dropping the lowest one.

There are for possible outcomes (given with totals):

1, 1 => 1
1, 2 => 2
2, 1 => 2
2, 2 => 2.

So the average will be:

7/4 = 1.75.

However, your method gives:

1, 2 => drop 1 => average 2, slightly higher than 1.75.


----------



## Tabarnak Smokeblower (Jul 11, 2003)

MeanGenes,

The exact mean for 5d6 drop 2 is 13.43.

Why did you use that precise distribution? Other distributions are as logical, and do not produce the same results, for example:

3d6: 1,8333 ; 3,5 ; 5,1666 (sum = 10,5)
4d6: 1,625 ; 2,875 ; 4,125 ; 5,375 (sum 3 best = 12,375)
5d6: 1,5 ; 2,5 ; 3,5 ; 4,5 ; 5,5 (sum 3 best = 13,5)

In fact, my 5d6 distribution seems to be closer to the truth that yours 

The reason your distribution is "flawed", IMO, is that random distributions won't go into "extremes", and that's why a more centralized distribution will produce results that are closer to reality...

TS


----------



## Gizzard (Jul 11, 2003)

> ...what would be ideal is a mass probability function so people can evaluate the likelihood of different results. (People have been asking for this for years and I've never seen such a formula to date.)




I'm not sure I understand what you are asking, but I use a Hypergeometric Distribution to calculate the probability of classes of important results.   

As a practical matter, I use it for analyzing card distribtution in MtG; it answers questions like "What's the probabilty of getting a Workshop, any Mox and a Juggernaut in hand by the time I have drawn 8 cards?"  The form of the distribution I use works for problems where there is no "replacement", ie, a drawn card is removed from future draw possibilities.  I thought there was a related distribution that allowed replacement, but Hypergeometric Distribution might be a good place to start.


----------



## SpuneDagr (Jul 11, 2003)

Nathan, I rewrote your formula (not in ascii). It makes more sense to me this way. Is it right?


----------



## Olgar Shiverstone (Jul 11, 2003)

The problem is that the "drop the lowest" of the dice changes the distribution, since the dropped die is itself a random variable, and none of the "typical" discrete distributions -- like hypergeometric -- apply.  The convolution of the variables (summing five uniform distributions and then conditionally discarding the two lowest-valued distributions) makes finding an expectation analytically very nasty.

There may very well be a closed form analytical solution, if you want to take the time to evaluate the solution, but frankly, given computing power it's faster just to run a short little program to evaluate all the possibilities.

Note that this is what Nathan's solution above gives us.  It's the equivalent (mathematically) of calculating all the possibilities and summing them to get an expectation.  Stick Nathan's formula into a basic program and it'll do what I suggested above (though I haven't checked evry step in his math).


----------



## kkoie (Jul 11, 2003)

Now if you had asked *ME* this question 3 years ago when I was taking a statistical annalysis class for my Masters Degree, I could've answered your question quite rapidly, but as it is... I've slept quite a bit since then, and my statistics book is neck deep in a stack of boxes in the garage.  But from what I've seen of the other posts, their formula's look rather sound.


----------



## Lamoni (Jul 11, 2003)

*Spreadsheets*

Thanks for that spreadsheet TS.

I modified it to give me the results for 3D6 + 1D8 drop lowest.

It has the following results:
3(-4): 0.1%
4-5(-3): 0.8%
6-7(-2): 3.4%
8-9(-1): 8.9%
10-11(+0): 16.4%
12-13(+1): 22.5%
14-15(+2): 23.0%
16-17(+3): 16.7%
18-19(+4): 7.2%
20(+5): 0.9%

The mean is 13.17

I think that I'll modify the spreadsheet a few more times to have results of other possibilities.  It can be a pain to copy those numbers, but all the formulas are easy.  It is much easier to use a spreadsheet than to try to strain my brain to do it with a standard formula.


----------



## Sabathius42 (Jul 11, 2003)

I haven't had time to read the very long and though out analytical answer (and I will as soon as I get a few moments of peace without having to run around after work) but I just wanted to say YOU GUYS/GALS ROCK!

We have been trying to figure this out at work for a couple weeks now, and got nothin.

DS


----------



## Tabarnak Smokeblower (Jul 11, 2003)

glad we could help!

TS


----------



## LazarusLong42 (Jul 11, 2003)

Well, I posted this:






a few months ago in one of these threads.  This formula also uses summations--no way around it--to determine the number of different rolls, _P_, available for a certain result, _R_, when using _k_ types of dice with _d(k)_ sides each, and rolling _n(k)_ of each type.

I didn't also use the drop-lowest, but I'm going to have to take some time to look through Nathan's solution 

*dcollins*:  What you describe would be nice, but using summations like these--though, yes, the mathematical equivalent of the brute-force approach--is exactly what you have to do.  The difference being that a mathematical description of the brute force approach is a lot easier to program into a computer.


----------



## Tabarnak Smokeblower (Jul 11, 2003)

My brain just blew up again.

TS


----------



## LazarusLong42 (Jul 11, 2003)

Well, explosive cranial decompression isn't all that bad.  It could've been your entire body


----------



## Morgenstern (Jul 11, 2003)

Actually, you can get around the massiv summations somewhat... I solved some of this sort of math for L5R (d10) because you use roll & drop for everything in that game (and it has open ended dice, but we don't need to fret over it here).

In my head, I deal with this as a series of 6x6x6 'outcome' cubes. Those are the dice you are going to keep. for a 5k3 roll, I have 36 of them. you can then start solving for number of possible outcomes of each result, and then use that to take an average (although the # of outcomes is much more useful since it shows you the -shape- of the probibility curve).

With a flat 3k3 you get

3: 1
4: 3
5: 6
6: 10
7: 15
8: 21
9: 25
10: 27
11: 27
12: 25
13: 21
14: 15
15: 10
16: 6
17: 3
18: 1

Which is convieniently symetrical, allowing you to casually determine the average is 10.5. That one is easy - it uses only one outcome cube and you can count through it with little trouble.

With the first extra dropped die (4k3), the range remains the same, but the shape of the curve distorts rapidly. You now have six cubes, each one reprsenting the above plus the 'extra die than could be used to substitute for any of the dice in above cube. If you build all six cubes and and then sum the possibiltes for each individual result (from 3 to 18), you can again see the curve and take an average. The first cube you have an extra '1' to play with and there is no change- no combination is improved by substituting the 1. In the second cube you have an extra '2', which changes 91 of the 216 outcomes of that cube by +1. Having an extra '3' to play with changes 152 of them (91 by +2, 61 by +1). An extra '4' alters 189 (91 by +3, 61 by +2, 37 by +1). A '5' affects 208 outcomes in it's cube (91 by +4, 61 by + 3, 37 by +2, 19+1), and finally a '6' affects 215 outcomes or all but one the 6+6+6 result (91 by +5, 61 by +4, 37 by +3, 19 by +2, 7 by +1). I may build full results tables on this thread if I get bored .

Even so, computing the average is pretty easy with that information (I'll post how next time ). In any event, the important thing to notice is that a larger extra roll impacts the average more, but each incremental increase affects far fewer new outcomes... This is significant because when you bring a second dropped die into consideration, it actually will have FAR less impact than the first one. The jump in the average between 3k3 and 4k3 and 5k3 isn't linear. It CAN'T be! As a simple example, if the increase in the average between 3k3 and 4k3 were +3 AND it was linear for each dropped die added, then the average would by higher than your maximum possible result by 6k3 (average 19.5 by that logic). Let me fiddle around with the tables a bit and see if I can't get you a specific answer for 5k3 using d6s. It can't be nearly as hard as doing it for d10s was (you are only discussing 7776 possible combinations instead of 100,000 )...


----------



## dcollins (Jul 11, 2003)

*Re: Analytical solution*

Okay, hopefully this can be considered a peer review. First, I'm not familiar with this "classification" strategy but as I follow it I note the following...



			
				Nathan said:
			
		

> *We now subdivide this classification further by the number r of dice that are lower than l. We see that r can run from 0 to n - 1. In our examples:*




It seems like r should run from 0 to k-1. If I'm mistaken, I'd like to see an example for our 5d6 case where r = n-1 = 5.



			
				Nathan said:
			
		

> *...where the number of B's is l*




I think you mean the value of the B's is l, not that it affects what follows.



			
				Nathan said:
			
		

> *All the r dice below l don't count for the total so let us neglect them.*




I'll assume that the number of dice that are l that also get dropped don't affect this multiplicity?



			
				Nathan said:
			
		

> *By the Gaußian summation formula, we have...*




This is the part that I'm not familiar with, so I'll have to take your word for it. I'm surprised that the various possibilities for C are all handled by this step.



			
				Nathan said:
			
		

> *1/n^d * [the sum over l = 1...r of the sum over r = 0...k-1 of the sum over u = 1..n - r of (n over r) * ((n - r) over u) * (l - 1)^r * (l*(u - (k - r)) + (n - u - r) * ((d + 1) * d / 2 - (l + 1) * l / 2)].
> *




I think your parentheses are a bit unbalanced... perhaps you need another curved closed parenthesis right at the end (to balance the one italicized above)? 


I'd like to see your comments as to if you feel this (esp. the first quote) affects your final formula, and then I too would like to see some numerical confirmation that this actually works out. (Although, again, the really useful thing would be a mass probability function.)


----------



## dcollins (Jul 11, 2003)

LazarusLong42 said:
			
		

> *I didn't also use the drop-lowest, but I'm going to have to take some time to look through Nathan's solution *




Lazarus, so if I'm reading you correctly, your formula doesn't take into account the dropping of low dice, which experience shows is really the hard part of this endeavor.




			
				LazarusLong42 said:
			
		

> *dcollins:  What you describe would be nice, but using summations like these--though, yes, the mathematical equivalent of the brute-force approach--is exactly what you have to do.  The difference being that a mathematical description of the brute force approach is a lot easier to program into a computer.  *




I can't agree with that. It seems a lot easier to describe:
- Make n nested loops from 1..d.
- (For dropping) Sort the n values at each step.
- Add up the high values and increment to an array of probability counts.
- After looping, print out (or whatever) that array.


----------



## Ferret (Jul 11, 2003)

I know this is hardly need or on topic but I worked out a while ago all the possible characters, stats race and single class. Hear are the mamoth numbers (1694 digits):

6.5076372374886954161012848881273e+1694


----------



## LazarusLong42 (Jul 12, 2003)

dcollins said:
			
		

> *Lazarus, so if I'm reading you correctly, your formula doesn't take into account the dropping of low dice, which experience shows is really the hard part of this endeavor.*



Correct on both counts; it is extremely hard to do.  I figured I'd put my formula out there for reference and as a starting point, as someone had already mentioned 3d6 + 1d8 drop lowest.


> *
> I can't agree with that. It seems a lot easier to describe:
> - Make n nested loops from 1..d.
> - (For dropping) Sort the n values at each step.
> ...



I suppose it depends on your situation and what you're trying to do.  If you're trying to find the average, then that might be slightly faster.  If, however, you want to find the probability of rolling, say, 65 on 20d6, I'll guarantee you that one summation/nested loop (mathematical formula) is faster than 20 nested loops (your way).

For the dropping problem... the verdict is out, I'd say.  I still haven't properly understood what Nathan's written above.   But even if it takes three extra nested loops for dropping, four nested loops (3 + 1) to run 5d6 drop 2 is faster than your five nested loops (one per die).


Edit:  I've just realized I'm mixing terminology.  What you describe may be easier to _write_ a program for.  The difference, I suppose, would be that my program will finish today for calculating the probability of getting 65 on 20d6 (the loop will run through the same few operations 8 times).

Your suggestion will run through the same set of operations 3,656,158,440,062,976 (6^20) times.  Assuming you only have one operation in your loop, and you are lucky enough to eke out a gigaflop from a Pentium machine, your program will finish running middle of next month.

So, yes, what you describe is easier to write, but it would be cumbersome to run.


----------



## Larry Fitz (Jul 12, 2003)

This is great, can you guys figure out the differential for using hollow pip dice?


----------



## Nathan (Jul 12, 2003)

SpuneDagr said:
			
		

> *Nathan, I rewrote your formula (not in ascii). It makes more sense to me this way. Is it right? *



Thank you!

One note: you should write the binomial coefficients (n over r) without the line between the n and the r, otherwise they look like fractions...


----------



## Nathan (Jul 12, 2003)

*Re: Re: Analytical solution*



			
				dcollins said:
			
		

> *Okay, hopefully this can be considered a peer review. First, I'm not familiar with this "classification" strategy but as I follow it I note the following...
> 
> 
> 
> ...



Yes, you're right. And this has already been right in the formula.



> *
> I think you mean the value of the B's is l, not that it affects what follows.
> *



Again, my mistake: I wanted to say the number of B's is u. It's value is l, of course.



> *
> I'll assume that the number of dice that are l that also get dropped don't affect this multiplicity?
> *



Yes!



> *
> This is the part that I'm not familiar with, so I'll have to take your word for it. I'm surprised that the various possibilities for C are all handled by this step.
> *



Formula by Gauß:

1 + 2 + 3 + 4 + ... + N = N * (N + 1) / 2.

Proof for this? Look at: (1 + N) + (2 + (N - 1)) + ... + (N/2 + (N/2) + 1) if N is even. Similar case for N odd.



> *
> I think your parentheses are a bit unbalanced... perhaps you need another curved closed parenthesis right at the end (to balance the one italicized above)?
> *




New formula:
1/n^d * [the sum over l = 1...r of the sum over r = 0...k-1 of the sum over u = 1..n - r of (n over r) * ((n - r) over u) * (l - 1)^r * (l*(u - (k - r)) + (n - u - r) * ((d + 1) * d / 2 - (l + 1) * l / 2))].

Hope, the parentheses are paired now!



> *
> I'd like to see your comments as to if you feel this (esp. the first quote) affects your final formula, and then I too would like to see some numerical confirmation that this actually works out. (Although, again, the really useful thing would be a mass probability function.) *



Thank you very much for your comments!

Hope you are familiar with the classification strategy right now...


----------



## JayOmega (Jul 12, 2003)

It's not a formula, but rec.games.frp.dnd had a post long ago that detailed all the possibilities for 3d6 drop 0 to 9d6 drop 6.

Nd6 probabilities 

Faster than doing all those summations, unless you need a 3d6+2d8 result or some such.


----------



## dcollins (Jul 12, 2003)

LazarusLong42 said:
			
		

> *If, however, you want to find the probability of rolling, say, 65 on 20d6, I'll guarantee you that one summation/nested loop (mathematical formula) is faster than 20 nested loops (your way).
> *




Of course, what I was responding to was your original comment was that it was "easier to program", not that it's "faster to execute". What you're saying now may in fact be true for sizable numbers of dice (like 20d6).

But again, what you specify above is an easy problem -- I believe there's a formula for that directly implied by standard probability theory. The hard part is "drop k dice", for which fundamental techniques exist that every programmer knows, whereas to date I've never seen a concise mathematical formula which solves the problem.


----------



## dcollins (Jul 12, 2003)

*Re: Re: Re: Analytical solution*



			
				Nathan said:
			
		

> *New formula:
> 1/n^d * [the sum over l = 1...r of the sum over r = 0...k-1 of the sum over u = 1..n - r of (n over r) * ((n - r) over u) * (l - 1)^r * (l*(u - (k - r)) + (n - u - r) * ((d + 1) * d / 2 - (l + 1) * l / 2))].
> *




Ah, one more thing, Nathan:
Should that first summation be "the sum over l = 1..d" ?


----------



## Nathan (Jul 12, 2003)

*Re: Re: Re: Re: Analytical solution*



			
				dcollins said:
			
		

> *
> 
> Ah, one more thing, Nathan:
> Should that first summation be "the sum over l = 1..d" ? *



Ah, yeah, of course. I have been obviously to sleepy recently...

Have you understood how to derive the summation formula for the 1 + 2 + ... + n?

Nathan


----------



## dcollins (Jul 12, 2003)

Yes, thanks... I've known that for [cough] longer than I care to admit, just didn't associate it with the name "Gaussian formula". 

I'm still investigating how that's helpful at that point... but more importantly, hoping to verify your formula numerically. (And even more more importantly, hoping to generate a probability mass function at some point, i.e., P(x=X)=? where X is some specific final result of the roll.)


----------



## dcollins (Jul 12, 2003)

Next set of questions:

- I guess the formula is invalid for k=0 (the case where you're not dropping any low dice -- l and r and the second summation are undefined)?

- On the first series of summations, where l = 1, and r = 0, how is it not undefined to have the third term (l-1)^r = 0^0?


----------



## LazarusLong42 (Jul 13, 2003)

dcollins said:
			
		

> *Of course, what I was responding to was your original comment was that it was "easier to program", not that it's "faster to execute". What you're saying now may in fact be true for sizable numbers of dice (like 20d6).
> 
> But again, what you specify above is an easy problem -- I believe there's a formula for that directly implied by standard probability theory. The hard part is "drop k dice", for which fundamental techniques exist that every programmer knows, whereas to date I've never seen a concise mathematical formula which solves the problem. *




On the first:  yeah, I got hung up for a moment on "easier to program" versus "easier to get a result for." 

What's specified (20d6) is, to be certain, a relatively easy problem, but the formula implied by probability theory still involves a summation.  This is because the die rolls don't create an actual normal distribution; they create a binomial distribution.  The formula standard formula for a single type of die is described here.  That's the best standard probability theory does.

I'm still working on the dropping problem, though; combining the standard formula linked with Nathan's work isn't going to be easy.


----------



## dcollins (Jul 13, 2003)

Let's take a trivial situation where we're rolling 2d1 and dropping 1 die. Clearly every roll is 1, so the average has to be 1. Define "choose" aCb = (a over b). Unfortunately, the proposed formula gives us (assuming 0^0 defined to be 1):

n=2, d=1, k=1.
AVG = 1/2 * sum (l=1) sum (r=0) sum (u=1, 2) [stuff]
= 1/2 * ([2C0 * 2C1 * 0^0 * (0 + 1*(1-1))] + [2C0 * 2C2 * 0^0 * (1 + 0*(1-1))]
= 1/2 * ([1*2*1*0] + [1*1*1*1])
= 1/2 * (0 + 1)
= 1/2

This is the same result given by a short .c program I've written to verify this. The same program gives degenerate results such as AVG(2d6 drop 1) = 483 and AVG(5d6 drop 2) = 31,533. Source file linked below (as .txt).

Comments about this analysis?


----------



## LazarusLong42 (Jul 13, 2003)

<blinks>

I hadn't even noticed the 0^0 that crept in there.  0^0 is not only not 1--it's completely undefined.  So... that means back to the drawing board.


----------



## sithramir (Jul 13, 2003)

I took a 400 level statistics course and know a function in my calculator that solves this problem quit easily. I "attempted" to look at your guy's math and it made my head hurt.


----------



## Nathan (Jul 14, 2003)

dcollins said:
			
		

> *Yes, thanks... I've known that for [cough] longer than I care to admit, just didn't associate it with the name "Gaussian formula".
> 
> I'm still investigating how that's helpful at that point... but more importantly, hoping to verify your formula numerically. (And even more more importantly, hoping to generate a probability mass function at some point, i.e., P(x=X)=? where X is some specific final result of the roll.) *



I have associated the formula with Gauß as there is an anecdote about him: when he was a 9-year-old pupil in school, the teacher was a little bit lazy and wanted to give his pupils an exercise which to solve would have taken some time for them. He asked them to add the first 100 positive integers.

Everyone started to add on number after the other. Except Gauß. He added:
1+100 + 2+99 + 3+98 + ... 50+55
= 101*50 = 5050.

However, I don't know if it is canon to name this formula by Gauß.

About the probability mass function:

Maybe the partition function P will come into play if one tries an analytic solution.

The partition function P is defined by:

P = number of ways to write n as a sum of weakly increasing positive integers.

For example P(2) = 2, as 2 = 1 + 1 and 2 = 2.

Problem here: our dice rolls don't come up sorted.


----------



## Nathan (Jul 14, 2003)

dcollins said:
			
		

> *Next set of questions:
> 
> - I guess the formula is invalid for k=0 (the case where you're not dropping any low dice -- l and r and the second summation are undefined)?
> 
> - On the first series of summations, where l = 1, and r = 0, how is it not undefined to have the third term (l-1)^r = 0^0? *



The formula doesn't make sense for k = 0, that is right. If you want a formula that makes sense for this case too, let l be the lowest die that won't be dropped. This is always well-defined.

To define 0^0 = 1 makes algebraically perfectly sense. And it should be defined this way as the multiplicator we need is in fact 1.

The problem with 0^0 occurs in calculus. 0^x is only continuous in 0 if you define 0^0 = 0, x^0 is only continuous in 0 if you define 0^0 = 1. Still, the "right definition" is 0^0 = 1 in this case.

Why is this right? Because it makes sense in any ring R with a unit.


----------



## Nathan (Jul 14, 2003)

dcollins said:
			
		

> *Let's take a trivial situation where we're rolling 2d1 and dropping 1 die. Clearly every roll is 1, so the average has to be 1. Define "choose" aCb = (a over b). Unfortunately, the proposed formula gives us (assuming 0^0 defined to be 1):
> 
> n=2, d=1, k=1.
> AVG = 1/2 * sum (l=1) sum (r=0) sum (u=1, 2) [stuff]
> ...



Aaargh!!! I really have made every typing mistake one could have made posting the deduction!

The denominator has to be d^n, not n^d, of course...


----------



## dcollins (Jul 14, 2003)

Nathan said:
			
		

> *The denominator has to be d^n, not n^d, of course... *




Right, I came up with that last night, thanks for noting that.

My program to verify this currently gives at least sane results for the case of 2Dd drop 1. However, other cases still don't appear correct, currently shows averages of:

2d1 drop 1 --> 1.000000
2d6 drop 1 --> 4.472222
3d6 drop 1 --> 3.402778
4d6 drop 1 --> 1.787809
5d6 drop 2 --> 3.379372
3d1 drop 1 --> 5.000000

I don't know if you have further comment on this, or I may have to start scratching out a 3dD drop 1 case by hand. Current .c program attached below.


----------



## dcollins (Jul 14, 2003)

Right, so with the current revised formula now consider a trivial case where we're rolling 3d1 and dropping 1 die. Clearly every roll is 2, so the average has to be 2. 

n=3, d=1, k=1.
AVG = 1 * sum (l=1) sum (r=0) sum (u=1, 2, 3) [stuff]

Some preliminary values in every sum:
nCr = 3C0 = 1
(n-r)Cu = 3Cu (so that's 3, then 3, then 1)
(l-1)^r = 0^0 = 1
((d+1)*d/2 - (l+1)*l/2) = 2*1/2 - 2*1/2 = 1-1 = 0
By the last, the large last term disappears in every sum.

Thus:
AVG = 1*3*1*(0) + 1*3*1*1*(1) + 1*1*1*(2) = 0+3+2 = 5.

Which is not the "2" which we would expect.
Comments at this point?


----------



## LazarusLong42 (Jul 15, 2003)

*Partial Success*

All right... here we go.

The following expression is equal to the number of possible rolls available for a given result _R_, when rolling _n_ dice with _d_ sides each, and keep the highest _k_ dice.  To get the probability for that result, divide the value of this expression by the value of _d_^_n_

However, this is only a partial success, as the expression works only in the special case where _n_ - _k_ = 1 -- that is, in the case where you drop only the lowest die.  But I'm using this as a jumping-off point for figuring probabilities where 1<_k_<_n_.







dcollins... would you care to test?  I've tested for several values myself, but I suspect you'll find any errors of mine quicker with your C programs, and I have no knowledge of C.


----------



## dcollins (Jul 15, 2003)

Interesting, let me ask a few questions first.

Well, first a comment... be careful, because:
Nathan defined k = number dropped.
Lazarus defined k = number kept.

Questions:
- Do the L-shaped brackets signify anything special, or are they just parentheses?
- Is it odd that the ranges i and j may have fractional upper bounds (division by k or d-j), same for that far right-hand term j/d?

Oh... I guess maybe the L-brackets are a "floor" operation (greatest lower integer)?


----------



## Nathan (Jul 15, 2003)

dcollins said:
			
		

> *Interesting, let me ask a few questions first.
> 
> Well, first a comment... be careful, because:
> Nathan defined k = number dropped.
> ...



Yes.


----------



## LazarusLong42 (Jul 15, 2003)

dcollins said:
			
		

> *Well, first a comment... be careful, because:
> Nathan defined k = number dropped.
> Lazarus defined k = number kept.
> *



I hadn't noticed that.  The reason I defined _k_ as number kept was that, as I was setting this up, I realized that the number kept was going to show up a lot more often, and would shorten the formula.


> *Questions:
> - Do the L-shaped brackets signify anything special, or are they just parentheses?
> - Is it odd that the ranges i and j may have fractional upper bounds (division by k or d-j), same for that far right-hand term j/d?
> 
> Oh... I guess maybe the L-brackets are a "floor" operation (greatest lower integer)? *



Indeed, that's exactly what they mean--and you've answered both questions with that 

When I have a chance (tomorrow, perhaps) I'll try to explain a bit about the deduction of the formula.  Note I say 'deduction' rather than 'derivation,' because rather than using Nathan's first-principles approach, I tend to approach this sort of thing from the other side, looking at the numbers in front of me.


----------



## Nathan (Jul 15, 2003)

dcollins said:
			
		

> *Right, so with the current revised formula now consider a trivial case where we're rolling 3d1 and dropping 1 die. Clearly every roll is 2, so the average has to be 2.
> 
> n=3, d=1, k=1.
> AVG = 1 * sum (l=1) sum (r=0) sum (u=1, 2, 3) [stuff]
> ...




The problem is the following: u = 1 and u = 2 don't correspond to any valid roll.

There is also another problem with the [stuff] that makes it basically counting the wrong things.

I changed the formula and tested the new one with dcollins' C-program.

The new formula is:

sum over l = 1 to d of sum over r = 0 to k of sum over u = 1 to n-k of (n over r) ((n - r) over (u + k - r)) * (l - 1)^r * [(d - l)^(n - k - u) * l * u + X * ((d+1)*d/2-(l+1)*l/2)]

Here, X is defined by

X := (n - k - u) * (d - l)^(n - k - u - 1). If d - l = 0 and n - k - u = 0, set X := 0.

Some remarks:

In this formula, l is the lowest dice that won't be dropped and u is the number of dice showing l that won't be dropped. This has changed! The new formula should work with the case k = 0 as well.

I will attach the modified test program by dcollins.

Extensive testing is appreciated!


----------



## Tabarnak Smokeblower (Jul 15, 2003)

I'm not sure why, but this whole thread is immensily amusing to me (not to mention almost uncomprehensible). 

TS


----------



## Nathan (Jul 15, 2003)

Tabarnak Smokeblower said:
			
		

> *I'm not sure why, but this whole thread is immensily amusing to me (not to mention almost uncomprehensible).
> 
> TS *



Enjoy yourself!


----------



## KeithHays (Jul 15, 2003)

Sabathius42 said:
			
		

> *I haven't had time to read the very long and though out analytical answer (and I will as soon as I get a few moments of peace without having to run around after work) but I just wanted to say YOU GUYS/GALS ROCK!
> 
> We have been trying to figure this out at work for a couple weeks now, and got nothin.
> 
> DS *




Nothin?  I gave you MeanGenes' solution a month ago!  It may not be technically correct, but you can USE it!


----------



## der_kluge (Jul 15, 2003)

Would this be easier if I slapped together a program to try to do this, and iterated through it a million times?


----------



## der_kluge (Jul 15, 2003)

Here is my code (yes, I'm a crusty old C programmer...):




> #include <stdio.h>
> #include <stdlib.h>
> #include <time.h>
> #include <sys/types.h>
> ...



_

My result = *final total = 12258902
final average = 12.258902
*

that is 4d6, drop the lowest one; keep the best 3.

(changing the value of NUMDICE (above) to 5)
which is 5d6, dropping the lowest two, keeping the best 3 is:

first run
*final total = 13402253
final average = 13.402253*

second run
*final total = 13406922
final average = 13.406922*

And just for fun:
3d6
*final total = 10512603
final average = 10.512603*

I might play around with it some more.  See if I can implement "re-roll 1s" into it.  That would be interesting to see..._


----------



## der_kluge (Jul 15, 2003)

And in case anyone cares:

3d6+1d8; keep the best 3.

final average = 13.144652   

Any other cooky combinations anyone wants me to try?
I'm going to put the "re-roll ones" logic in it next, and I made it so that it takes parameters, so I can just feed it stuff at the command-line so I don't have to recompile it all the time.


----------



## ichabod (Jul 16, 2003)

Okay,

I have a spreadsheet which works for up to 9d6. From that I extracted a symbolic function which works for any number of dice, keeping any number, with any number of sides as long as they have the same number of sides. Unfortunately, I cannot figure out how to make one of these nice graphics of the function to post it. In any case, the formula is so complicated that it would take a rather large graphic to understand it. I have included a MS word doc with the equation as a MS Equation 3.0 object. If this is not adequate, perhaps some enlightened soul can make a graphic out of it, or tell me how to do so in Word or Mathcad.

First of all, I am confident the spreadsheet is correct, but I have not tried to test my symbolization of it. Second of all, it is a bunch of summations, but it's not as bad as it looks. Finally, I came up with some kludges to make it work symbolicaly, but perhaps someone with a more theoretical math background can clean it up.

What the equation does is run through all possible sorted combinations of the kept dice that add up to the specified value, and figures out the number of combinations that result in that sorted set of kept dice, sums them all up, and divides by total possible combinations. Where the trick comes in is that figuring out the number of combinations requires a multinomial coefficient, but the inputs to the multinomial coefficient depend on how many and which values on the kept dice are equal to each other. That's what the c_j's calculate.

To represent this, I kludged up the functions represented by circle plus and circle times. Circle plus returns a 1 if the two values are equal, and a 0 if they aren't. Circle times returns a 1 if they aren't equal, and a 0 if they are (it's the negation of circle plus, and is included to clean up the main function a bit). Perhaps there is some better way to represent this mathmatically, but if there is I don't know it.

die kluge, I have a python module that will calculate the exact probability distribution (including mean, median, and standard deviation) of just about any combination of dice you could think of, using brute force. For a reasonable number of dice, it's quite fast. If you (or someone else) wants it, let me know.


----------



## LazarusLong42 (Jul 16, 2003)

Ichabod:

I'm going to look over your solution later, and see if (1) I can make it work, and (2) if I can make the symbolics a bit easier 

Edit:


> *
> What the equation does is run through all possible sorted combinations of the kept dice that add up to the specified value, and figures out the number of combinations that result in that sorted set of kept dice, sums them all up, and divides by total possible combinations. Where the trick comes in is that figuring out the number of combinations requires a multinomial coefficient, but the inputs to the multinomial coefficient depend on how many and which values on the kept dice are equal to each other. That's what the c_j's calculate.*



Heh... I needed to read further than skimming.  What you've done is to define, mathematically, a brute-force algorithm for determining the correct result.  Which is, I'll admit, pretty clever... but that's not what we're trying to do.  We want to do this without all the iterations; theoretically, per die we should be able to boil things down to half the number of iterations or less (so, for 10 dice, 1/1024 = 1/2^10 or less iterations than running things for every possible roll).

I think we all can do this via brute force, though


----------



## ichabod (Jul 16, 2003)

LazarusLong42 said:
			
		

> *Would you be willing to post the spreadsheet as well?  I've been trying to deduce symbolic representations from patterns in the combinatorics, but couldn't find a pattern in anything dropping more than one die. *




Sure, spreadsheet is attached. I tested the idea on easy to check things, like 3d3 drop 1, and 4d6 drop 1. I'm going out tonight to celebrate 13 years without a cig, but now that I have the python code finished I can check the whole thing. I'll also try to program in the formula, and test it, but I may get distracted. In any case, I think I forgot to mention that the formula depends on treating 0^0 as 1. It could be rewritten without that assumption, but it would make the formula even messier.

The spreadsheet is set up only for keeping 3d6 and rolling up to 9d6. Enter the number of dice into '# of dice', and it should give you the whole distribution. The patterns in the combinatorics took me a long time to figure out, but I finally realized that once you're dropping more than one die, you have to start summing multinomials.

In the spreadsheet, all the sorted three die combinations are on the left. Then there are four collumns showing calculating the possible combinations for the four possible was the three dice could be equal: all 3 equal, top 2 equal, low 2 equal, and none equal. These are taken using an offset on the tables to the far right, where the summing of multinomials is done. Then the 'Combos' collumn figures out which equality situation actually exists, and then gets the correct number of combinations. The chart with the distributions sums up all the combos with the correct number is the 'Total' collumn.


----------



## ichabod (Jul 16, 2003)

LazarusLong42 said:
			
		

> *
> Heh... I needed to read further than skimming.  What you've done is to define, mathematically, a brute-force algorithm for determining the correct result. *




No! What I did is a step back from brute force. The dice you keep are done brute force, but the dice you drop are done with the summing of multinomials. For example, with 9d6 drop 6, you have 10,077,696 combinations, but you are only brute forcing through 56 of the combinations of the kept dice. Admittedly, this is not useful if you are keeping a lot of dice and dropping few, but it certainly a step towards what you are looking for. Now, if someone can figure out a non-brute force way to determine how many of each multinomial is required, you have a completely non-brute force way to do it.


----------



## dylanarena (Mar 9, 2007)

Hello folks,

I'm happy to have come across this thread.  I'm writing a package for the open-source statistical programming language/environment called "R" that calculates things people want to know about dice rolls, and this was a great first function for me.

Nathan, I built the function based on your analysis, so thank you very much!
And then I extended it so that it also calculates the probabilities of each possible outcome (e.g., P{roll 5d6, drop 2, and get a 15}).  I was able to skirt brute force: it generates all possible combinations--but *not* all possible orderings (e.g., {1,1,2} but not {1,2,1} or {2,1,1})--of the kept dice, and then calculates how many permutations there are of each combination (but doesn't generate them).  

Anyway, the details are in the function, which is in the package, which will be up on the CRAN website in a few weeks and will (since it's open-source) be available for further inspection.  I'm fishing for more dice probability questions folks want answered, though: I'll post another thread asking about that right now.  I just wanted to stop in here and thank you all (Nathan and all the folks who helped tweak the final algorithm).


Cheers,
Dylan


----------



## Celebrim (Mar 9, 2007)

Thank God for math nerds.

All good technology doth proceed from them.  The scientists feed on the products of the math nerds.  The engineers feed on the products of the scientists.  And everyone else lives well because of them.

Threads like this warm my heart.  No band of D&D sword swingers is more heroic.


----------



## dcollins (Mar 9, 2007)

dylanarena said:
			
		

> Nathan, I built the function based on your analysis, so thank you very much!




I do hope you test your software against a brute-force method (please).


----------



## Gwaihir (Mar 9, 2007)

This thread rocks. And to think I never believed my teachers that math would be important to know for real life.


----------



## orsal (Mar 9, 2007)

Nathan said:
			
		

> Formula by Gauß:
> 
> 1 + 2 + 3 + 4 + ... + N = N * (N + 1) / 2.
> 
> Proof for this? Look at: (1 + N) + (2 + (N - 1)) + ... + (N/2 + (N/2) + 1) if N is even. Similar case for N odd.




That formula predates Gauss by about 2000 years. The famous connection with Gauss is the anecdote of his rediscovering it when he was 8 years old.


----------



## dylanarena (Mar 9, 2007)

dcollins said:
			
		

> I do hope you test your software against a brute-force method (please).




Absolutely: I checked it against the table of results posted earlier in this thread and against a brute-force run for a few combinations that weren't that table.  It's got all of the latest revisions you guys found in your iterative process, and the addition of the probabilities of individual outcomes checks out empirically as well.


----------



## dylanarena (Sep 14, 2007)

OK, the software package that calculates what has been discussed in this thread has been released:

http://cran.r-project.org/src/contrib/Descriptions/dice.html

It requires the use of the open-source R statistical programming environment, so there's a bit of an up-front investment of time (download/install R if you don't already have it, then install the package "dice"), but the package is there if anyone wants to play around with it. 

(Note that I credit this thread with providing the context and foundation for the package's existence.)

Cheers,
Dylan


----------



## Treebore (Sep 14, 2007)

I don't worry about the math. I let players play the character they want, including stats. If that means they give themselves all 18's, then so be it. Its not like its hard to account for high stats. Plus, I get to decide stats the same way for NPC's and monsters. So high stats are easy to "balance out".

So my players get to play the character they want, right down to their ability scores.


----------



## 1of3 (Feb 1, 2012)

*raise_thread*

Hi everyone, I have a question about Nathan's formula. I take it, that's the formula as presented.

ImageShack® - Online Photo and Video Hosting


I'm not sure about parentheses. I'd multiply binomials and (l-1)^r with the results of the Cs as well. Like this...

1/(n^d) SUM SUM SUM nCr (n-r)Cu (l-1)^r 
*(* l(u-k+r) + (n-u-r)( (d+1)d-(l+1)l )/2 *)

*I may be wrong, of course. If so please tell me how.


----------



## OnlineDM (Feb 2, 2012)

This is an interesting double-necro. A thread from 2003 was raised in 2007, and now again in 2012. I expect some sort of Halley's Comet effect, and we'll see it again around late 2017 or something.

But as for the topic itself, I was glad to see this thread; I'd been pondering the math behind 4d6 drop the lowest recently.


----------



## 3D (Feb 4, 2014)

*Analytical solution*

I haven't read all the posts, but here is my analytical solution, it is writen in python3, but it should also work with python2 if you change the print-function:


###############################################################


al=[] 
s=0 # summ


# The Array "al" is filled with all possible combinations,
# it takes into account that rolling [1,1,1,1,2] got the same probability than rolling  [2,1,1,1,1]

for a in range(1,7):
>    for b in range(1,7):
>>        for c in range(1,7):
>>>            for d in range(1,7):
>>>>                for e in range(1,7):
>>>>>                    al.append([a,b,c,d,e])

# sort the array and add the 3 highest throws

for i in range(6**5):
>    al_.sort()
>    s=s+al[2]+al[3]+al[4]

## divide summ by the number of possibilitys 

print(s/(6**5)) 

# solution: 13.43016975308642

#########################################

Even this is calculated with the pc its not brute-force, it takes each possibility (6^5)  which can be rolled into account.

I hope this helps_


----------



## Sabathius42 (Feb 6, 2014)

I rarely read, and even more rarely post on Enworld nowadays.  I happened to hop on tonight since I am waiting for dinnertime.

I saw this thread title and thought to myself "I remember asking a question like that a long time ago."

This is truly a thread that doesn't seem to die.

DS

Good work everyone!


----------



## GX.Sigma (Feb 6, 2014)

Ah, so this was before anydice.com?

http://anydice.com/program/1744


----------



## Isaac Cussen (May 29, 2017)

http://rumkin.com/reference/dnd/diestats.php   It has the formula to quickly assess as well as a quick break down on how to input your own formula adjustments.


----------

