["Gather 100 people in a room and keep giving money to a random partner" will gradually make a difference between rich and poor](http://gigazine.net/news/20170711-random-people-give-money-to- There is a Gigazine article called random-other-people /).
I think there are various impressions such as "Oh, that's right" and "Oh, I was surprised", but since it is a simple experiment, I tried changing various conditions and it was surprisingly interesting, so I will introduce it.
I felt that there were few people with 100 people, so I will try with 1000 people.
The histograms of the amount of money possessed on turns 10, 100, 1000, and 10000 and the number of people are as follows.
Basically, it feels like a normal distribution centered around 1000. You can see that the base expands as the trial is repeated.
When giving to a richer person than yourself, there is a 10% chance of re-deciding who to give.
The distribution is similar, but the base is narrower than before. Is it safe to say that wealth is being redistributed?
On the contrary, when giving to a poorer person than yourself, there is a 10% chance of re-deciding who to give.
This time, on the contrary, the base has expanded greatly. It is a disparity society w Is it a microcosm of a society that does not ask the poor to work?
This time, there are no particular conditions for giving money like the very first, but if the first money you have is 50.
The number of people whose money becomes 0 increases, and those who do not have money do not give it to anyone, so it seems to be quite biased.
This is the script I used this time. You can run it on Jupyter Notebook.
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
%matplotlib inline
N = 1000 #Number of people
M = 1000 #First money
P = 0 #Probability of rethinking when handing over to the rich and poor.If not 0.10%Then 0.1。
plot_index = [10, 100, 1000, 10000] #Turn number to display the graph
T = max(plot_index)
plt.figure(figsize=(24, 6))
def transfer_money(moneys):
transfer = np.zeros_like(moneys)
for i in range(N):
if moneys[i] > 0:
while True:
to_money = np.random.randint(0, N)
#If you do not give it to the rich: `moneys[to_money] > moneys[i]`
#If you do not give it to the poor: `moneys[to_money] < moneys[i]`
if moneys[to_money] < moneys[i] and np.random.random() < P:
continue
break
transfer[i] -= 1
transfer[to_money] += 1
moneys += transfer
moneys = np.ones((N, )) * M
for i in range(T+1):
if i in plot_index:
plt.subplot(1, len(plot_index), plot_index.index(i)+1)
ax = sns.distplot(moneys, kde=False, bins=20)
ax.set_title("i=%d" % i)
ax.set_xlabel("money")
ax.set_ylabel("person count")
transfer_money(moneys)
plt.show()
This kind of thing is fun.
Recommended Posts