Question
''' Activity 05: Solve the following model by hand and using Python C = 160 + 0.6*Yd I = 150 G = 150 T =
''' Activity 05: Solve the following model by hand and using Python
C = 160 + 0.6*Yd I = 150 G = 150 T = 100 '''
from scipy.optimize import fsolve def fn1(vars,*args): C, Yd, T, I, G, Y = vars eq01 = C - ( c0 + c1*Yd ) # Consumption Function eq02 = Yd - ( Y - T ) # Disposable Income eq03 = T - T_bar # Tax Function eq04 = I - I_bar # Investment Function eq05 = G - G_bar # Government Expenditure eq06 = Y - ( C + I + G ) # Equilibrium Condition return [eq01,eq02,eq03,eq04,eq05,eq06] # Exogenous Variables G_bar = 150 I_bar = 150 T_bar = 100
# Parameters c0 = 160 # Autonomous Consumption c1 = 0.6 # Marginal Propensity to Consume
C, Yd, T, I, G, Y = \ fsolve(fn1, (1,1,1,1,1,1), \ args=(G_bar,I_bar,T_bar,c0,c1))
from datetime import datetime now = datetime.now() print('------------------------------------------') print(" Started: ", now) print('------------------------------------------') print('Name: Bob Han) print('Editor: Notepad++') print('*** Endogenous Variables ***') # T, I, G, Y print("01 Consumption: %5.2f" % (C)) print("02 Disposable Income: %5.2f" % (Yd)) print("03 Income: %5.2f" % (Y)) print(' ') print('*** Exogenous Variables ***') print("01 G_bar: %5.2f" % (G_bar)) print("02 T_bar: %5.2f" % (T_bar)) print("03 I_bar: %5.2f" % (I_bar))
now2 = datetime.now() print('------------------------------------------') print(" Ended: ", now2) print('------------------------------------------')
with open('Activity05.txt', 'w') as f: f.write(' ' "01 Consumption: %5.2f" % (C)) f.write(' ' "02 Disposable Income: %5.2f" % (Yd))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started