FOR 100 PEOPLE, EVERYONE OWNS 100 YUAN. EVERYONE GIVES ANOTHER RANDOM PERSON 1 YUAN EVERY MINUTE.
THEN WHAT HAPPENS.
Try to simulate this with matplotlib in Python.
----2017.7.16
I learned how to use matplotlib and numpy in the past two days. It's not going very well. I find that it's really hard for me to learning these things with only official docs. There are too many items to read and I don't know where to find what I want.
Anyway, after 'wasting' a lot of time, I wrote a little program simulate the problem I mentioned, though very lame. I saw this problem inzhihu, where there are many answers. It seems that this problem does't with our speculation with probability knowledge. I thought this way in the beginning, too. But after I simulated and thought about it, I find something tricky.
After like 1 million loops in this simulation, the richest one may have several hundred yuan or even a thousand, and the poorest may have nothing left. Or if we allow debts, the poorest may have several hundred yuan debt at last. Most people would be surprised at this result, for we often think people's money should be almost the same. People say it is counter-intuitive.
Here is the tricky part. There is a "trap" in this problem----everyone has to give 1 one to another person in every loop. After a million loops, everyone has paid a million yuan. By contrast, the differences between their wealth are only about a thousand. That means, everyone pays a million yuan, and some of them earned hundreds of yuan, some of them lose hundreds of yuan. It's almost the same, isn't it?
So, the fact is, I think, that our feelings of the differences between people's wealth are magnified by the limited property----100 yuan each.
----2017.7.18
This is my awful code below. I really need to learn more. I don't know how to use FuncAnumation now.
import random
import numpy as np
import matplotlib.pyplot as plt
zeros = []
money = np.ones(100)*100
for i in range(100000):
for j in range(100):
if i in zeros:
continue
r = random.randint(0, 99)
while r == i:
r = random.randint(0,99)
money[r] += 1
money[i] -= 1
if r in zeros:
zeros.remove(r)
if money[i] == 0:
zeros.append(i)
plt.bar(np.arange(100), money, 1, color='g', edgecolor='k')
plt.show()