added chart of inflation: debt vs ubi

This commit is contained in:
likho 2025-08-23 20:27:19 -07:00
parent 3c425f7465
commit b9a0ab4df6

View File

@ -107,7 +107,7 @@ def visualize_ubi(terms=25):
continue
shares.append(calc_share_of_wealth(data))
sow = pd.DataFrame(shares)
print(sow.keys())
# print(sow.keys())
x = [i for i in range(1,terms)]
assert(len(x) == len(shares))
@ -132,5 +132,46 @@ def visualize_ubi(terms=25):
plt.show()
return
visualize_ubi(terms=50)
# visualize_ubi(terms=50)
def calc_total_supply(df):
total = []
for key, data in df.items():
if key == "name":
continue
total.append(sum(data))
return total
def visualize_inflation(terms=50):
participants = ["Alice", "Bob", "Charlie"]
balances = [100,40,20]
df = get_balances_over_time (
participants, balances, ubi,
terms = terms
)
total_supply_ubi = calc_total_supply(df)
df_si = get_balances_over_time (
participants, balances, simple_interest,
terms = terms
)
total_supply_si = calc_total_supply(df_si)
# + 1 because the initial frame is included this time
x = [i for i in range(1,terms+1)]
assert(len(x) == len(total_supply_si))
plt.style.use('dark_background')
plt.plot(
x, total_supply_ubi, color="cyan", label="UBI"
)
plt.plot(
x, total_supply_si, color="red", label="Debt (Simple Interest)"
)
plt.title("Money Supply over Time: UBI vs Simple Interest")
plt.legend()
plt.xlabel("Terms")
plt.ylabel("Total Currency")
plt.show()
visualize_inflation(terms=75)