revising models

This commit is contained in:
mhjensen
2018-05-09 16:44:52 -04:00
parent 239a7c172c
commit c4865d0ada
13 changed files with 6021 additions and 983 deletions
+5 -5
View File
@@ -7,9 +7,9 @@ import random
# initialize the rng with a seed
random.seed()
# Hard coding of input parameters
Agents = 100
Agents = 500
MCcounts = 1000
Transactions = 10000
Transactions = 100000
startMoney = 1.0
Lambda = 0.0
FinancialAgents = startMoney*np.ones(Agents)
@@ -19,17 +19,17 @@ for i in range (1, MCcounts, 1):
agent_j = int(Agents*random.random())
epsilon = random.random()
if agent_i != agent_j:
m1 = Lambda*FinancialAgents[agent_i] + (1-Lambda)*epsilon* (FinancialAgents[agent_i] + FinancialAgents[agent_j])
m1 = Lambda*FinancialAgents[agent_i] + (1-Lambda)*epsilon*(FinancialAgents[agent_i] + FinancialAgents[agent_j])
m2 = Lambda*FinancialAgents[agent_j] + (1-Lambda)*(1-epsilon)*(FinancialAgents[agent_i] + FinancialAgents[agent_j])
FinancialAgents[agent_i] = m1
FinancialAgents[agent_j] = m2
# the histogram of the data
n, bins, patches = plt.hist(FinancialAgents, 20, facecolor='green')
n, bins, patches = plt.hist(FinancialAgents, 50, facecolor='green')
plt.xlabel('$x$')
plt.ylabel('Distribution of wealth')
plt.title(r'Money')
plt.axis([0, 10, 0, 100])
plt.axis([0, 10, 0, 500])
plt.grid(True)
plt.show()