Back to Crafty Games Welcome, Guest. Please login or register.
Did you miss your activation email?
July 28, 2014, 01:20:02 AM
Home Help Search Login Register
News: Welcome to the Crafty Games Forums!

Note to New Members: To combat spam, we have instituted new rules: you must post 5 replies to existing threads before you can create new threads.

+  Crafty Games Forum
|-+  Community
| |-+  License to Improvise
| | |-+  Formula derivation for finding arithmetic mean of an exploding die
« previous next »
Pages: [1] 2 Go Down Print
Author Topic: Formula derivation for finding arithmetic mean of an exploding die  (Read 1218 times)
Bill Whitmore
Mastermind
Control
*****
Posts: 2333


Woot, I got a new hat! :P


View Profile
« on: November 12, 2012, 01:55:49 PM »

I have had a couple of requests to show how the mean value of an exploding die is calculated.

If you do not like math, stop reading now.

You have been warned.


What follows is not an exhaustive proof, merely the steps I went through to derive the formula for calculating mean values of an exploding die.

These existing formulas and properties will be used below, so understanding how they work is necessary:
   Arithmetic mean
   Commutative Property of Addition
   Summation
   Sum of a Geometric Series

Definition:
   Exploding Dice: When certain numbers are rolled, the die is rolled again, adding the result to the total. This may be repeated as long as a triggering value is rolled.

In all cases, the following variables and restriction are in place:
   Let x = an integer that is the total number of sides on one die
   Let y = an integer that is the total number of sides on one die that explode
   Each face of the die has a unique integer value in the interval [1, x]
   x > 0
   0 <= y < x



Does the mean value of an exploding die change based on which face of the die causes the explosion?
   Let f(x) be the mean value of a die.

   Assuming the die explodes on a 1 then the result of a 1 adds the result of another die roll.
      f(x) = ((1 + f(x)) + 2 + 3 + ... + x) / x

   Assuming the die explodes on the highest result then the result of x adds the result of another die roll.
      f(x) = (1 + 2 + 3 + ... + (x + f(x))) / x

   Does ((1 + f(x)) + 2 + 3 + ... + x) / x = (1 + 2 + 3 + ... + (x + f(x))) / x?
      The only difference is the placement of the recursive f(x) term and per the Commutative Property of Addition the order of the summation does not effect the end total.

   Thus which face causes the explosion does not change the mean value of the die.


What is the effect of allowing more than 1 face of the die to explode?
   Again, let f(x) be the mean value of a die.

   Assuming that the die explodes on 1 facing yields:
      f(x) = (1 + 2 + 3 + ... + x + f(x)) / x

   Assuming that the die explodes on 2 facings yields:
      f(x) = (1 + 2 + 3 + ... + x + f(x) + f(x)) / x
         or
      f(x) = (1 + 2 + 3 + ... + x + 2f(x)) / x

   Assuming that the die explodes on 3 facings yields:
      f(x) = (1 + 2 + 3 + ... + x + f(x) + f(x) + f(x)) / x
         or
      f(x) = (1 + 2 + 3 + ... + x + 3f(x)) / x

   Assuming that the die explodes on y facings yields:
      f(x, y) = (1 + 2 + 3 + ... + x + yf(x)) / x

   The formula can be rewritten as
      ((1 + 2 + 3 + ... + x) / x) + (yf(x, y) / x)
   with the blue portion simply being summation of numbers from 1 to x and can be replace with (x(x+1)) / 2
      (((x(x+1)) / 2) / x) + (yf(x, y) / x)
   which can be further simplified to
      ((x+1) / 2) + ((y/x)f(x, y))

   Thus f(x, y) = ((x+1) / 2) + ((y/x)f(x, y))


What is the formula to calculate the mean value of an exploding die?
   To make this easier to see, let A = (x+1) / 2 so
      f(x, y) = A + (y/x)f(x, y)

   This is the sum of a geometric series and looks as follows:
      f(x, y) = A + A(y/x) + A(y/x)2 + A(y/x)3 + A(y/x)4 ...

   In this case, the common ratio is r = y/x.  The sum of a geometric series converges so long as -1 < r <  1.  Thus, this series only converges if -x < y < x.

   Per the assertion up top, 0 <= y < x so this series converges and can be calculated as follows
      f(x, y) = A / (1 - r)
   In this case, A = (x+1) / 2 and r = y / x so
      f(x, y) = ((x+1) / 2) / (1 - (y / x))
   which simplifes to
      f(x, y) = (x + 1) / (2 * (1 - (y / x)))

   Thus the mean value of a die with x sides and exploding on y faces can be found using the formula f(x, y) = (x + 1) / (2 * (1 - (y / x)))
Logged

Don't follow your passion.  Take it with you.

ALL HAIL THE FLYING SPAGHETTI MONSTER!   Ramen.
Bill Whitmore
Mastermind
Control
*****
Posts: 2333


Woot, I got a new hat! :P


View Profile
« Reply #1 on: November 12, 2012, 01:56:20 PM »

If you have any questions, comments or see any errors please let me know.
Logged

Don't follow your passion.  Take it with you.

ALL HAIL THE FLYING SPAGHETTI MONSTER!   Ramen.
MilitiaJim
Control
******
Posts: 4288



View Profile WWW
« Reply #2 on: November 12, 2012, 02:14:02 PM »

If you have any questions, comments or see any errors please let me know.
Why did my eyes start to bleed?

It's probably unrelated.  This makes sense to my minimal math savvy.
Logged

"Quemadmodum gladius neminem occidit, occidentis telum est."  ("A sword is never a killer, it's a tool  in the killer's hands.")
- Lucius Annaeus Seneca "the younger" ca. (4 BC - 65 AD)
Bill Whitmore
Mastermind
Control
*****
Posts: 2333


Woot, I got a new hat! :P


View Profile
« Reply #3 on: November 12, 2012, 02:23:45 PM »

Why did my eyes start to bleed?

I did post a red warning sign at the top so I take no responsibility for bleeding eyes. Wink
Logged

Don't follow your passion.  Take it with you.

ALL HAIL THE FLYING SPAGHETTI MONSTER!   Ramen.
Blankbeard
Handler
*****
Posts: 781



View Profile
« Reply #4 on: November 12, 2012, 03:26:13 PM »



Does the mean value of an exploding die change based on which face of the die causes the explosion?

You can save yourself a lot of trouble here by using the definition of a fair die.  If action dice are fair dice then each face is equally likely to appear and the answer to that question must be "no."

If action dice aren't fair dice, none of the rest of the formulas will work with them.


What is the effect of allowing more than 1 face of the die to explode?

What is the formula to calculate the mean value of an exploding die?


If you work out the limits for infinitely exploding action dice of various sizes, you should notice a relationship between the base value of the die (average (n+1)/2) and the exploded value.  For a die of n sides exploding on x sides, that ratio is n/(n-x).  You can simplify it to n^2+n/(2(n-x)) but most anyone who plays these games knows the average of most die so I like to leave the ratio.
Logged
Morgenstern
Control
******
Posts: 5194



View Profile
« Reply #5 on: November 12, 2012, 04:48:31 PM »

One less mathmatical, and more perceptual value that should be mentioned is minimum result.

With non-exploding dice and exploding on any face except 1, the minimum result is 1. On action dice that explode on a 1 the minumum result is 2, and that result is only possible if a 2 is the result of an initial roll.

This has a pretty profound result on situations where a player is looking at a failed roll and thinking "If that were just 2 higher, I'd succeed..."

Another thing that is interesting about exploding dice is that if the exploding faces are above the median, they do not change the median result of the die... on a d6, half of all results are 3 or less if it doesn't explode or explodes on any value of 4 or higher. So placment of exploding faces does have considerable impact on the median result and thus affects expectations, particularly on pass/fail conditions with a set value no greater than the the maximum number of faces on a die. If all you need is a result of 5 while rolling a d6, exploding on a 6 is irrelevant, and exploding on a 1 is quite useful.
« Last Edit: November 12, 2012, 04:50:33 PM by Morgenstern » Logged

At your own pace: Do. It. Now.
How about some pie? - Heroes of the Expanse
Morgenstern
Control
******
Posts: 5194



View Profile
« Reply #6 on: November 12, 2012, 05:09:22 PM »

So, to go a little further on why Lady Luck's smile become increasingly irrelevant as career level rises...

Mean values are a usful tool primarily when multiple rolls will be added together and the totals have a cumulative effect. The only place where that occurs in the Spycraft system is damage rolls (I include sistuations where the excess on an attack check is converted to damage) and Refreshing - both of these operations affect a running total. Roll a 77 on an action die while refreshing and yes, that has an impact.  Most roll are threshhold checks - if the save DC is 18, it doesn't matter that your action dice turned in a legendary result of 914. Averages have limited meaning when dealing with thresholds.

So say your d20 has left you in the not so improbable circumstance that you can only succeed by spending an action die and getting a result of 6 or more. Across the 1-5 career level range Lady Luck's smile is handy - you roll a '3' you get annother shot at producing a total of 6 or higher. At levels 6-10 its still in there trying to save the day - a 5 is now gong to be a success. At levels 11+ its meaningless - you already reached the required total, rerolling and adding on a result of 7 (on a d8) or 9 (on a d10) is meaningless to the outcome.

Conversly, re-rolling on a 1 is always valuable in that situation, across all level ranges.
Logged

At your own pace: Do. It. Now.
How about some pie? - Heroes of the Expanse
Krensky
Control
******
Posts: 6938


WWTWD?


View Profile
« Reply #7 on: November 12, 2012, 06:11:33 PM »

Well, let' see what happens if we try that.

ad typemeandeviation
d43.3333301542.78882173
d4 LLS4.9951171884.965700281
d4 New LLS4.9951171873.842603435
d64.1999999313.261900026
d6 LLS5.2499110914.904363287
d6 New LLS5.2499110913.681917087
d85.1428571383.801181242
d8 LLS5.9999942785.29142224
d8 New LLS5.9999942783.999938011
d106.111111114.360314846
d10 LLS6.8749992965.789256658
d10 New LLS6.8749992964.445846418
d127.0909090914.927574627
d12 LLS7.7999998716.327714491
d12 New LLS7.7999998714.943681203

Ok, so a we know changing LLS to explode on 1 and the highest does nothing to the mean. It reduces the deviation significantly though, and as you said it boosts the minimum to two and reduces the likelihood of a minimum by a lot. I actually like that change.

We'd need to come up with something else for Bold Heroes and Tales of the Rascal though.

(click to show/hide)
Logged

We can lick gravity, but sometimes the paperwork is overwhelming. - Werner von Braun
Right now you have no idea how lucky you are that I am not a sociopath. - A sign seen above my desk.
There's no upside in screwing with things you can't explain. - Captain Roy Montgomery
Blankbeard
Handler
*****
Posts: 781



View Profile
« Reply #8 on: November 12, 2012, 06:38:36 PM »

One less mathmatical, and more perceptual value that should be mentioned is minimum result.

With non-exploding dice and exploding on any face except 1, the minimum result is 1. On action dice that explode on a 1 the minumum result is 2, and that result is only possible if a 2 is the result of an initial roll.

That's probably the only reason to prefer exploding on ones.  It does have a nice psychological cushion effect.  It doesn't actually make much difference but it keeps a player from feeling his heroic mojo just let him down.

This has a pretty profound result on situations where a player is looking at a failed roll and thinking "If that were just 2 higher, I'd succeed..."

Another thing that is interesting about exploding dice is that if the exploding faces are above the median, they do not change the median result of the die... on a d6, half of all results are 3 or less if it doesn't explode or explodes on any value of 4 or higher. So placment of exploding faces does have considerable impact on the median result and thus affects expectations, particularly on pass/fail conditions with a set value no greater than the the maximum number of faces on a die. If all you need is a result of 5 while rolling a d6, exploding on a 6 is irrelevant, and exploding on a 1 is quite useful.

We gone around about this before.  I know it seems like what you're saying is true but the reality is that regardless of which number the die explodes on you're going reach the same result over the course of an evening or a career.  Exploding on a one doesn't get you to a total of five any more often than exploding on a six does. 

So, to go a little further on why Lady Luck's smile become increasingly irrelevant as career level rises...

Mean values are a usful tool primarily when multiple rolls will be added together and the totals have a cumulative effect. The only place where that occurs in the Spycraft system is damage rolls (I include sistuations where the excess on an attack check is converted to damage) and Refreshing - both of these operations affect a running total. Roll a 77 on an action die while refreshing and yes, that has an impact.  Most roll are threshhold checks - if the save DC is 18, it doesn't matter that your action dice turned in a legendary result of 914. Averages have limited meaning when dealing with thresholds.

I guess you're including rolls like autofire and the knife mastery trick in damage rolls.  But don't forget about opposed rolls.  You only need beat your opponent by one, but you need every bit of the total because he's got the same tools you do (and maybe larger action dice).

So say your d20 has left you in the not so improbable circumstance that you can only succeed by spending an action die and getting a result of 6 or more. Across the 1-5 career level range Lady Luck's smile is handy - you roll a '3' you get annother shot at producing a total of 6 or higher. At levels 6-10 its still in there trying to save the day - a 5 is now gong to be a success. At levels 11+ its meaningless - you already reached the required total, rerolling and adding on a result of 7 (on a d8) or 9 (on a d10) is meaningless to the outcome.

Conversly, re-rolling on a 1 is always valuable in that situation, across all level ranges.

Yeah confirmation bias will lead to you remembering the time that 1 exploded and you weren't paralyzed and you saved the whole party.

It'd be a good campaign quality if for no other reason that rolling high is its own reward.
Logged
Krensky
Control
******
Posts: 6938


WWTWD?


View Profile
« Reply #9 on: November 12, 2012, 06:57:33 PM »

This has a pretty profound result on situations where a player is looking at a failed roll and thinking "If that were just 2 higher, I'd succeed..."

Another thing that is interesting about exploding dice is that if the exploding faces are above the median, they do not change the median result of the die... on a d6, half of all results are 3 or less if it doesn't explode or explodes on any value of 4 or higher. So placment of exploding faces does have considerable impact on the median result and thus affects expectations, particularly on pass/fail conditions with a set value no greater than the the maximum number of faces on a die. If all you need is a result of 5 while rolling a d6, exploding on a 6 is irrelevant, and exploding on a 1 is quite useful.

We gone around about this before.  I know it seems like what you're saying is true but the reality is that regardless of which number the die explodes on you're going reach the same result over the course of an evening or a career.  Exploding on a one doesn't get you to a total of five any more often than exploding on a six does. 

Actually it does. A straight d6 action die will roll a five or better about a third of the time. Exploding on a 1 results in a five or better just shy of 44 percent of the time.
Logged

We can lick gravity, but sometimes the paperwork is overwhelming. - Werner von Braun
Right now you have no idea how lucky you are that I am not a sociopath. - A sign seen above my desk.
There's no upside in screwing with things you can't explain. - Captain Roy Montgomery
Morgenstern
Control
******
Posts: 5194



View Profile
« Reply #10 on: November 12, 2012, 08:06:07 PM »

We gone around about this before.  I know it seems like what you're saying is true but the reality is that regardless of which number the die explodes on you're going reach the same result over the course of an evening or a career.  Exploding on a one doesn't get you to a total of five any more often than exploding on a six does.

Take a look at that statement again.

Target: 5 rolling a d6 without explosions. Chance of success 33% (2 outcomes in 6).
Target: 5 rolling a d6 with unlimited explosions on 6. Chance of success 33% (2 outcomes in 6).

Notice that while the average jumped considerably, the chance of success didn't move at all.

Target: 5 rolling a d6 with a single explsion on 1. Chance of success ~41.6% (15 outcomes in 36).
Target: 5 rolling a d6 with up to two explsions on 1s. Chance of success ~43.5% (94 outcomes in 216).
Target: 5 rolling a d6 with up to three explsions on 1s. Chance of success ~43.9% (569 outcomes in 1296).
Target: 5 rolling a d6 with 4 or more explsions on 1s. Chance of success ~43.98% (3420 outcomes in 7776).

The reality is averages don't reflect thresholds - because the results are not being summed. They are being converted in a binary operation to 0s (failures) and 1s (successes). In a more extreme case a series of ten results of 1, 1, 1, 1, 1, 1, 1, 1, 1, 11 yeilds an average of 2. Since the average is 2 and the threshold is 2, I succeeded half the time, right? Nope.

Similar argument as you mentioned about crits, its not the average number of crits in a sample of 400 rolls that maters, its how many checks are required to give me a 50% chance that one has occured. When all results above X are equivalent to X, a result of 100 is no better than a result of X, and while a result of 100 pulls the average up, it does not intrinsically shift the likelyhood of success. Explosions are result replacements (instead of a six, I now had 1/6ths chances of a 7, 8, 9, 10, 11, or 12 replacing that result), and if they take place on results at or beyond the threshold they do not shift the likelyhood of achiving that threshold. If they takeplace on results below the threshold, they do.

Quote
I guess you're including rolls like autofire and the knife mastery trick in damage rolls.

Actually I mean straight linear conversions. Sword Supremacy may be the only one that survived into Fantasycraft.
« Last Edit: November 12, 2012, 08:31:40 PM by Morgenstern » Logged

At your own pace: Do. It. Now.
How about some pie? - Heroes of the Expanse
Morgenstern
Control
******
Posts: 5194



View Profile
« Reply #11 on: November 12, 2012, 08:42:09 PM »

Ok, so a we know changing LLS to explode on 1 and the highest does nothing to the mean. It reduces the deviation significantly though, and as you said it boosts the minimum to two and reduces the likelihood of a minimum by a lot. I actually like that change.

We'd need to come up with something else for Bold Heroes and Tales of the Rascal though.

At this point I will issue a sly little smile that the differences between Lady Luck's Smile and Tales of the Rascal in terms of deviation are directly linked to their placment in the trees - as a Chance feat, I wanted Lady Luck's Smile to drive the deviation way up - this tree is the home of people who like wild outliers. And as a chance feat it contributes to the most richly interlinked of all the "benefits based on number of feats in a tree" trees. Tales of the Rascal is a Species feat (hence the other benefit in the complete package) and is confering the grace of a folklore figure who consistently achieved 'the imposible'. Reducing the deviation (compared to LLS) and driving up the reliablity was exactly the goal and distinction being made between the two feats Smiley.
« Last Edit: November 12, 2012, 08:50:48 PM by Morgenstern » Logged

At your own pace: Do. It. Now.
How about some pie? - Heroes of the Expanse
Krensky
Control
******
Posts: 6938


WWTWD?


View Profile
« Reply #12 on: November 12, 2012, 09:05:00 PM »

Ok, so a we know changing LLS to explode on 1 and the highest does nothing to the mean. It reduces the deviation significantly though, and as you said it boosts the minimum to two and reduces the likelihood of a minimum by a lot. I actually like that change.

We'd need to come up with something else for Bold Heroes and Tales of the Rascal though.

At this point I will issue a sly little smile that the differences between Lady Luck's Smile and Tales of the Rascal in terms of deviation are directly linked to their placment in the trees - as a Chance feat, I wanted Lady Luck's Smile to drive the deviation way up - this tree is the home of people who like wild outliers. And as a chance feat it contributes to the most richly interlinked of all the "benefits based on number of feats in a tree" trees. Tales of the Rascal is a Species feat (hence the other benefit in the complete package) and is confering the grace of a folklore figure who consistently achieved 'the imposible'. Reducing the deviation (compared to LLS) and driving up the reliablity was exactly the goal and distinction being made between the two feats Smiley.


Too subtle by far.

And how they interact with the d4 is a classic example of what happens when you get too cute. Wink

I'll have to figure out how to program the old High Roller core to see what it does to the numbers.
« Last Edit: November 12, 2012, 09:09:18 PM by Krensky » Logged

We can lick gravity, but sometimes the paperwork is overwhelming. - Werner von Braun
Right now you have no idea how lucky you are that I am not a sociopath. - A sign seen above my desk.
There's no upside in screwing with things you can't explain. - Captain Roy Montgomery
Morgenstern
Control
******
Posts: 5194



View Profile
« Reply #13 on: November 12, 2012, 09:52:24 PM »

Too subtle by far.

*shrug* Its how I think - I knew the two mechanics had different cosequences and those consequences would play better to different crowds Smiley.

Quote
And how they interact with the d4 is a classic example of what happens when you get too cute. Wink

Touche. I hadn't really anticpated a player taking both of them. Lady Luck's Smile's stand-alone value is low enough I didn't anticipate it being the first (or only) Chance feat a character might take. Add in the relative scarcity of Species feats and the number of builds featuring both before 6th level seemed passably low... I still see it as a corner case scenario, and I don't use the related campaign quality, ever, so going back to try and root it out wasn't all the pressing either. Exploring some appoaches that would reduce its impact was part of the thread we spun off from (lock action dice to d6s, only allow a single explosion) worked, but just didn't seem worth the trouble.

Changing LLS to reroll 1s will make it an all around better feat. Not really scary because its kinda weak presently, but I'd still be looking at changes to Fortunate to tone down the cumulative power of the tree.

Quote
I'll have to figure out how to program the old High Roller core to see what it does to the numbers.

Looking forward to it Smiley.
Logged

At your own pace: Do. It. Now.
How about some pie? - Heroes of the Expanse
Krensky
Control
******
Posts: 6938


WWTWD?


View Profile
« Reply #14 on: November 12, 2012, 10:01:45 PM »

Too subtle by far.

*shrug* Its how I think - I knew the two mechanics had different cosequences and those consequences would play better to different crowds Smiley.

That's actually kind of what I mean. Most players don't even know what we're talking about here, let lone how LLS compares to ToR regarding deviation or thresholds. Just that both give more explosions. That's why people take both even though it doesn't make much sense to you.

* Shrug.
Logged

We can lick gravity, but sometimes the paperwork is overwhelming. - Werner von Braun
Right now you have no idea how lucky you are that I am not a sociopath. - A sign seen above my desk.
There's no upside in screwing with things you can't explain. - Captain Roy Montgomery
Pages: [1] 2 Go Up Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.13 | SMF © 2006-2011, Simple Machines LLC Valid XHTML 1.0! Valid CSS!