Unexpected Maths: Finding maths where you'd least expect it.

 An exploration of of various maths topics that appear in the most unexpected of places, and what they can teach us about the fascinating world we live in.

Roll For Initiative

Roll For Initiative

You're reading a maths blog. Suddenly, a wild post appears, bearing down on you with the full might of its unproven theroems and complicated definitions! Roll for initiative!

Please don't sue me, Nintendo.

Please don't sue me, Nintendo.

Don't judge my magic abilities or I'll turn you into a "Guess Who?" Character.

Don't judge my magic abilities or I'll turn you into a "Guess Who?" Character.

...that sounded like a better intro in my head, not going to lie.

If you can't tell by now, I'm a massive nerd.

As such it shouldn't surprise you to hear that I'm a frequent Game Master.

Not quite that kind of game master, but sure. To quote my CV, for the University Roleplaying Society, I "regularly create and control game scenarios for a group of players as a Game Master. This involves many skills, including leadership of a team, preplanning of scenarios and improvising where necessary, being able to create an engaging, captivating storyline, and being able to act and perform in a variety of roles". To put it another way, I spend Wednesday afternoons rolling dice with a group of my friends to see what happens in a story I'm creating. I'm a massive nerd.


The main dice we'll be focusing on. These Wolf dice were a birthday gift from my best friend Lucy. I love this set so much. Note I wrote the d(10•10) the wrong way round- it is important to put the multiplier "inside" the dice indicator.

The main dice we'll be focusing on. These Wolf dice were a birthday gift from my best friend Lucy. I love this set so much. Note I wrote the d(10•10) the wrong way round- it is important to put the multiplier "inside" the dice indicator.

A Standard Dice Set

You may be wondering where this is going. Don't worry, we've already mentioned the main players. Let's meet them!

Here we have a standard roleplayer's dice set. It is made up of 7 dice. These are denoted as above; the "d" means "dice" and the number after it denotes the number of sides on the dice. Given no other information, we assume the dice is fair, balanced, and numbered from 1 to the number of faces. The one exception to this is the d10 and d10•10, which are from 0-9 and 00-90 respectively. The d10•10 is a d10 where all the numbers are multiplied by 10, and this is indicated with a "•10" inside the dice indicator. This should not be confused with the dice code 10d10, which we cover below...


Dice Codes: indicating any roll type

So this section might get a bit confusing but it's important to define everything we're going to use before we use it. It might be a good idea to try out different dice codes if you have any dice sets to get the hang of the codes!

From the highest priority to the lowest: 

  • Brackets should be used to avoid confusion where necessary. Braces {} must be avoided to group terms as must square brackets [] as these both have special significance.

  • Anything following the letter "d" indicates a dice to be rolled.

  • A number following the letter "d" indicates the number of sides of a dice to be rolled. In the absence of any other information, we roll a single dice, with the usual numbering. Example: "d4" means "roll a 4-sided dice of the usual numbering".

  • A number before a "d" is technically ambiguous. For this reason, we will define it here as one use and define the other below. We will define this to mean "roll the code following this many times and sum the results", e.g. "2d4" means "roll 2 four sided fair dice and add the results together".

  • A set of numbers in braces after a "d" indicator indicates a nonstandard numbering of a dice, e.g. d{1,3,3,6} has a 1 in 4 chance to give a 1, a 1 in 4 chance to give a 6, and a 1 in 2 chance to give a 3.

  • A number in braces before a "d" means "roll the dice code this many times, but produce a set from it- do not sum the results"- e.g. {3}d4 produces the set {|d4|, |d4|, |d4|}, but with the dice rolls evaluated (there is unfortunately no standard way to indicate this- so we will indicate this using vertical bars). A possible result from this therefore may be {2, 1, 4}. As order does not matter, this is equivalent to {1, 2, 4}.

  • An addition symbol after a dice roll indicates to roll the dice as normal and then add on the number- e.g. 1d4+2 gives the results {3, 4, 5, 6}.

  • An extension to the above is the notation 3(d4+2) where three rolls of |d4+2| are performed and the results are summed. {3}(d4+2) acts as you would expect too.

  • A dice multiplier multiplies every number on the dice by a constant amount- e.g. 1d10•10.

  • Dice can be nested- can you work out what {2d4}(3d(2d6+2)) would produce? It's very complicated, but it can be done!

  • Certain letters and symbols mean certain things: L(n): keep only the lowest n results; H(n): keep only the highest n results; <n: only keep results lower than n; =n: only keep results equal to n; =n[]: roll [] for every result that equals n (exploding dice); /r: instead of ignoring non-matching dice, reroll them (e.g. 3d6>3/r); /n: divide dice by n, rounding to the nearest integer (e.g. (1d6)/2 gives possible results {1, 1, 2, 2, 3, 3}); %n: dice code is modulo n- divide result by n, keeping the remainder ((1d10)%4 gives possible results {1, 2, 3, 0, 1, 2, 3, 0, 1, 2}); [@]: dice code is the same as the full expression (recursive dice) e.g. 3d6=6[@] means for every 6 you roll in 3d6, roll another 3d6, and so on, until you roll no more 6's.

That was a lot. We should now be equipped to roll whatever we want now, however.

As a reward for all this work, have a picture of my fanciest dice. They're made of Emeralds.

As a reward for all this work, have a picture of my fanciest dice. They're made of Emeralds.


Wrapping up

Before we get to this week's homework, we need to talk about one more thing in probability. I promise this won't be too hard.

The expectation value of a probabilistic set is the weighted sum of the outcomes divided by the total number of outcomes. What this means is that we take each possible result, multiply them by how many there are, then divide by the total. For example, E({2,2,2,3,4,5}) = (2x3 + 3 + 4 + 5)/(6) = 18/6 = 3.  This number is the average number we would expect if we rolled this dice a large number of times, say a million. A normal d6 has and expectation value of 3.5, which means that if we add up a million rolls and divide by a million, we should get about 3.5. For a normal dn, the expectation value is (n+1)/2. Can you prove why? Try using a pairing argument on the set of possible outcomes!


Your Weekly Quest

Wondering out of the city, you start on your quest for the mythical temple of the Dragon Lord. You know it's either North, South, East or West of the city. Your mentor has given you nothing but a dice code to go on, as a test to see if you're worthy of the Dragon Lord's prescence. Given that 1 = North, 2 = East, 3 = South, and 4 = West, what direction should you go in? The dice code you have is as follows:

1d({4}((d10%2)+1/r1)) 

The answer will start next week's post! 

-Wolfie <3

Taking a break

Addendum: Code for bridging numbers

Addendum: Code for bridging numbers