In the original article that was inspired, it's not a fortune, but a gacha, but ...
When the probability becomes clear, it is meaningless unless it is understood correctly. A common mistake is the belief that if the probability of appearance is 1%, it will almost certainly come out if you draw the gacha 100 times. As a matter of fact, the probability of hitting a gacha with a probability of 1% by pulling it 100 times is only about 63%. In other words, if 100 players draw 100 times each, 63 will win, but the remaining 37 will lose 100 times. http://www.4gamer.net/games/999/G999905/20160305003/
What does that really mean? A brief introduction to the mathematical background, calculation and illustration in Python.
1% chance of winning each time If you draw a gacha 100 times in a row, may you never win? !!
It is that. If you draw an Omikuji at a shrine, you can't usually restore it (instead, it will be tied to somewhere in the shrine's precincts), so each time you draw it, you will lose one from all the Omikuji. (Non-restoration extraction). In this gacha, one out of 100 lottery is always won, so it is a restoration extraction. (Speaking of Omikuji, it is equivalent to returning your lottery)
So
1% chance of winning each time If you draw a gacha 100 times in a row, may you never win? !!
Let's quantify. This is equivalent to pulling a loss 100 times in a row.
(1-0.01)^{100}=0.99^{100}
I hope you can calculate. If you let me calculate with python,
>>> 0.99**100
0.3660323412732292
Therefore, it will not hit even once about 0.366 ≒ 36.6%
(sorry). This is the original article
The remaining 37 people are all lost 100 times.
That's the part.
In this case, the non-restoration extraction is performed 100 times in a row, so the "binomial distribution" is equivalent in mathematics.
A common story is a context like "How many times does the back or front of the coin come out?", But the way the front side comes out is Ibitsu, "The probability that the front comes out is 0.01, the probability that the back comes out is 0.99" It is a situation like this. (I would like to see what kind of coin it is, but ...)
Then, the probability of getting a r
hit in 100 non-restoring extracts is
\begin{eqnarray}
{}_{100} C _r\times 0.01^r\times (1-0.01)^{100-r}
\end{eqnarray}
r = 1
\begin{eqnarray}
{}_{100} C_1\times 0.01\times (1-0.01)^{99} = 100\times 0.01\times 0.99^{99}=0.3697...
\end{eqnarray}
⇒It's about 0.370
, so the probability of not winning even once and the probability of winning once are almost the same.
r = 2
\begin{eqnarray}
{}_{100} C_2\times 0.01^2\times (1-0.01)^{98} = 4950\times 0.01^2\times 0.99^{98}=0.1849...
\end{eqnarray}
⇒ This time it is about 0.18
, so the probability will suddenly be halved ...
It is difficult to think about each individual case each time, so if you draw a (probability) distribution, you can see the whole picture.
import pandas as pd
import numpy as np
init = 0
trial = 100
prob = 0.01
###Recursively calculate combinations
def comb(n, r):
if n == 0 or r == 0: return 1
return comb(n, r-1) * (n-r+1) / r
###Calculate the probability of being r times
def binominal(n,r,p):
return comb(n,r)*(p**r)*((1-p)**(n-r))
###Function vectorization
bi = np.vectorize(binominal)
###Have the number of trials in an array
arr = np.arange(init, trial)
###Calculate binomial distribution by vector operation
plot_values = pd.DataFrame(bi(trial, arr, prob), columns=['probability'])
###Illustrated
plot_values.plot()
⇒ The peak ends near 0
and 1
, and the probability is rapidly approaching 0 ... (sweat)
The distribution of ↑, the one who saw it somewhere is sharp. It's a Poisson distribution. On the "binomial distribution" page of Wikipedia If> n is large and p is small enough, then np is reasonably large, so the Poisson distribution with the parameter λ = np gives a good approximation of the binomial distribution B (n, p). That is, when the expected value λ = np is constant and n is sufficiently large,
P[X=k]\simeq \frac{\lambda^ke^{-\lambda}}{k!}
There is. We used python
to calculate r = 0, 1, 2
, but let's try applying k = 0, 1, 2
to the above formula. Note that λ = 100 × 0.01 = 1
is generally
P[X=k]\simeq \frac{1}{e\times k!}
So
P[X=0]=P[X=1]=\frac{1}{e} \simeq 0.3679...
And you can see that the probabilities are about the same when r = 0, 1
. further,
P[X=2]=\frac{1}{2e}\simeq 0.1839...
So, in the case of r = 2
, the probability of r = 0, 1
is half, which is almost correct!
Recommended Posts