From 9bdfbd8d85c296fbae7ad81aed79394df66dc529 Mon Sep 17 00:00:00 2001 From: scuti Date: Sun, 28 Sep 2025 16:22:39 -0700 Subject: [PATCH] Changed one of the visualizations to compare different APRs. Demonstrate 3-5$ APR and compare with linear. --- econ-demo.py | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/econ-demo.py b/econ-demo.py index 683ef8f..3bd4cf8 100644 --- a/econ-demo.py +++ b/econ-demo.py @@ -30,7 +30,7 @@ def ubi(balances, dividend=10, terms=3): new_bal.append(b) return new_bal -def get_balances_over_time(names, balances, func, terms=4): +def get_balances_over_time(names, balances, func, terms=4, param=0): if func is None: print("Need a function!") return @@ -44,7 +44,10 @@ def get_balances_over_time(names, balances, func, terms=4): df = pd.DataFrame(data) for t in range(1,terms): key = str(t) - frame = func(balances, terms=t) + if param == 0: + frame = func(balances, terms=t) + else: + frame = func(balances, terms=t, rate=param) if frame is not None: df[key] = frame return df @@ -167,12 +170,34 @@ def visualize_inflation(terms=50): plt.style.use('dark_background') plt.plot( - x, total_supply_ubi, color="cyan", label="UBI (n=3, du=10)" + x, total_supply_ubi, color="cyan", label="? (linear)" ) plt.plot( - x, total_supply_si, color="red", label="Debt (APY=5%)" + x, total_supply_si, color="red", label="apy = 0.05" ) - plt.title("Money Supply over Time: UBI vs Compounding Interest") + plt.plot( + x, + calc_total_supply(get_balances_over_time( + participants, + balances, + compounding_interest, + terms=terms, + param=0.04 + )), + color="orange", label="apy = 0.04" + ) + plt.plot( + x, + calc_total_supply(get_balances_over_time( + participants, + balances, + compounding_interest, + terms=terms, + param=0.03 + )), + color="yellow", label="apy = 0.03" + ) + plt.title("Supply of Money Over Time") plt.legend() plt.xlabel("Terms") plt.ylabel("Total Currency")