Monetary Circuit Model/incomes.py
Appearance
load('graphing.py')
# Time variable
t = var('t')
# The first argument to function() is the symbol displayed when rendered.
# e.g, 'B_v' is displayed as B subscript v. The second argument is the
# function parameter(s)
bv = function('B_v', t)
bt = function('B_t', t)
fl = function('F_l', t)
fd = function('F_d', t)
wd = function('W_d', t)
# Parameters
# Initial bank capital
ibc = 100
# Cash rate of outflow from the bank vault
bvo = 3.0 / 4.0
# Repayment rate of loans (debt turned over every 7 years)
rr = 1.0 / 7.0
# Consumption rate (entire pay spent every 2 weeks)
wcr = 26.0
# Wage rate
fwr = 2.0
# Interest rate on loans (5%)
irl = 0.05
# Interest rate on deposits (2%)
ird = 0.02
# Bank consumption rate
bcr = 1.0
lend = bvo * bv
repay = rr * fl
wages = fwr * fd
cons = wcr * wd
interest = irl * fl
compound = irl * fl
fidep = ird * fd
widep = ird * wd
bankcons = bcr * bt
# ODE system
des = [
diff(bv, t) == repay - lend,
diff(bt, t) == interest - bankcons - fidep - widep,
diff(fl, t) == lend - repay - interest + compound,
diff(fd, t) == lend - repay + cons - wages + bankcons + fidep - interest,
diff(wd, t) == wages - cons + widep
]
# Solve the system
sol = desolve_system(des,
[bv, bt, fl, fd, wd],
[0, ibc, 0 , 0 , 0 , 0],
t)
# Labels for the functions
labels = {
bv : "Bank Vault",
bt : "Bank Transactions",
fl : "Firm Debt",
fd : "Firm Deposits",
wd : "Worker Deposits"
}
# Uncomment to plot ode model
#p = plot_ode(labels, sol, t, set([bt, wd]))
# Calculate and plot profits
profitShare = 0.4
turnover = 0.3
profits = profitShare / turnover * fd
workers = wages + widep
capitalists = profits + fidep
bankers = interest - fidep - widep
p = plot_expr([workers, capitalists, bankers],
["Workers", "Capitalists", "Bankers"],
sol, t)
p.save("graph.svg")
p.show()