User:Guy Bukzi Montag/sandbox

''Nothing to see here. It's only my playground for future blog posts.''

Everything on this page is a draft and will be deleted when the final post is published.

''If you do see something here, it's probably a blog post in the making. Feel free to comment, corrections are welcome!''

---

Drop Rates Explained: 5th Anniversary (III)

Part I and II of this post are finished and an now be found under Drop Rates Explained: 5th Anniversary (I) and Drop Rates Explained: 5th Anniversary (II).

---

This is part III of a series on the maths behind drop rates.


 * Part I: Practical questions
 * Part II: Extracting probabilities
 * Part III: More than one box

This part continues the explanations of part II and will show you how to calculate your chances if you open more than one box. The 5th Anniversary boxes will serve as examples, but the methods also work for other boxes.

Introduction

 * "I need 2 more blueprints to assemble my SLK 55 SE. If I buy a Specialist Bundle, my chance of getting a blueprint is 10 %. I have 4,825 coins, so I can buy 32 bundles. Will that be enough to get my 2 missing blueprints?"

To answer this question, it's reasonable to start with fewer boxes:

One box
If you buy one box, there are only two possibilities: either you get a blueprint or not.
 * Your chance of getting a blueprint is $$\tfrac{1}{10}$$,
 * and $$\tfrac{9}{10}$$ of getting none.

Two boxes
Buying two boxes already offers four possibilities, each with its own probability:
 * blueprint in the first one: $$\tfrac{1}{10}$$
 * blueprint also in the second one: $$\tfrac{1}{10} \cdot \tfrac{1}{10} = \tfrac{1}{100}$$
 * no blueprint in the second one: $$\tfrac{1}{10} \cdot \tfrac{9}{10} = \tfrac{9}{100}$$
 * no blueprint in the first one: $$\tfrac{9}{10}$$.
 * blueprint in the second one: $$\tfrac{9}{10} \cdot \tfrac{1}{10} = \tfrac{9}{100}$$.
 * no blueprint also in the second one: $$\tfrac{9}{10} \cdot \tfrac{9}{10} = \tfrac{81}{100}$$.

As you need 2 blueprints, only the first of the four combinations is successful and has a probability of $$\tfrac{1}{100}$$ = 1 %. A chance of 1 % is not very satisfying, but we now know how to find the values for three boxes.

Three boxes
In the following table, "B" stands for blueprint, "0" for no blueprint and P for the probablity of the combination. Successful combinations with at least two blueprints are highlighted:

As you see, there's more than one way to get two blueprints: You can get them from the first and second, second and third or from the first and third box. And there's also the possibility of getting even three blueprints, so 4 out of 8 sequences are successful.

The probability of getting at least 2 blueprints from 3 boxes is


 * $$\frac{9}{1000} + \frac{9}{1000} + \frac{9}{1000} + \frac{1}{1000} = \frac{28}{1000} = 2.8 %$$.

If you never buy more than three boxes, you can stop here. You can make a small table, multiply the probabilities and sum up the successful sequences. But that's not realistic as events like the 5th Anniversary grant a lot more than three boxes.

Permutation
And that's where the problem starts: Technically you have been examining all possible ways of drawing 3 elements from 2, with repetition (you put pack what you have drawn, because a 0 or a B can appear several times), and where order matters (because 0-0-B is not the same as B-0-0). In combinatorics, this is called a permutation with repetition.

Unfortunately, those permutations have the nasty habit to generate extremely large numbers. If you draw once, you have only two possibilities: 0 and b. The second draw (box) adds two more possibilities to every existing one, so you get $$2 \cdot 2 = 2^2 = 4$$ possibilities, then $$2 \cdot 2 \cdot 2 = 2^3 = 8$$ and so on. Ten boxes would already generate a table with $$2^{10} = 1,024$$ rows, so counting manually all successful combinations becomes impossible with increasing numbers of draws (boxes).

But now we know how to calculate the total number of possibilities:


 * Buying $$n$$ boxes granting 1 random item generates $$2^n$$ possibilities.

For our SLK 55 SE example, this means: If you buy 32 boxes, you get $$2^{32} = 4,294,967,296$$ possible sequences.

Combination
Now we have to find all those of our $$2^n$$ sequences that contain at least the desired number $$k$$ of blueprints we want.

In our example table with 3 boxes and 2 wanted blueprints ($$n= 3, k = 2$$) we had $$2^3 = 8$$ sequences of which 4 were successful. How can we calculate the 4 successful ones? Let's have a closer look at them:


 * The three sequences 0-B-B, B-B-0 and B-0-B have in common that they are arrangements of 2 blueprints in a set of 3 items.
 * The fourth sequence consists of 3 blueprints in a set of 3 items: B-B-B.

Note that this time the order of the Bs doesn't matter: blueprint is blueprint. For example, there is no distinction between a possible B1-B2-B3 and B1-B3-B2. They are all treated as one sequence B-B-B, so there is only one way to arrange 3 blueprints in a set of 3 items.

How many blueprints do I get for n coins?
Let's assume that you have. With those coins you can buy either
 * 3 Expert Bundles ( each) or
 * 7 Specialist Bundles ( each) or
 * 14 Novice Bundles ( each).

The Expert bundle grants at least 1 Audi R8 e-tron SE blueprint per box; the maximum number you can get is 7. Assumed that there are no underlying probabilities for certain amounts of blueprints, you can imagine this as an urn containing 7 boxes: one box with 1 blueprint, one box with 2, one with 3 and so on. If you draw one box from the urn, each box and thus each amount of blueprints has the same probability: $$\tfrac{1}{7}$$.

As you can buy 3 Expert Bundles for your coins, you can draw 3 times from the urn (with putting back the drawn item).
 * The probability of getting the maximum number of blueprints from 3 draws (i. e. 3 times box number 7) is $$\tfrac{1}{7} \cdot \tfrac{1}{7} \cdot \tfrac{1}{7} = \tfrac{1}{7^3} = \tfrac{1}{343}$$ = 0.29%.
 * Each other combination of boxes has the same probability of $$\tfrac{1}{343}$$, but there are several combinations that grant, for example, 20 blueprints (maximum number minus 1): 7-7-6, 7-6-7 and 6-7-7, each with a probability of $$\tfrac{1}{343}$$. So the probability for 20 blueprints is $$\tfrac{3}{343}$$ = 0.87%.
 * This leads to the question in how many ways you can combine three summands from 1 to 7 so that the result is the desired number of blueprints. You can imagine that as throwing a seven-sided dice three times. Technically, this is a special case of a composition problem which is examined in combinatorics (see Wikipedia article for further explanations).

The probability of getting the maximum number of items from d draws out of n items is $$\frac{1}{n^d}$$.

As the number of draws equals the number of boxes you can buy, the number of boxes is defined by $$\lfloor\frac{amount of coins}{box price}\rfloor$$ Bla

\begin{align} m &= \sum_{k=0}^{\lfloor \frac{s-n}{7} \rfloor} (-1)^k \cdot \binom nk \cdot \binom{s - 1 - 7k}{n - 1}\\ &= \sum_{k=0}^{\lfloor\frac{s-n}{7}\rfloor} (-1)^k \cdot \frac{n!}{k! \cdot (n-k)!} \cdot \binom{s - 1 - 7k}{n - 1} \end{align} $$

Bla

with m: probability of a sum n: amount of boxes s: sum of blueprints

How many coins do I need to assemble a car with a probability of 90 %?
Bla

Which bundle grants more tokens: Expert or Specialist?
Bla

Appendix
Mercedes-Benz SE:

The amount of boxes needed to get at least 1 (one!) blueprint with a probability of 90 % is


 * $$n \geq \frac{\ln(1 - 0.9)}{\ln(1 - 0.1)} = 21.85$$.