import matplotlib.pyplot as plt import numpy as np %matplotlib inline G = 100 # government spending theta = 0.2 # tax rate n_rounds = 30 # number of rounds we'll consider # create an array of numbers from 0-30, one for each spending round r = np.arange(0,n_rounds) # solve equation 1 for each individual round y = G*(1-theta)**r # solve equation 2 for each individual round sum_y = G*(1-(1-theta)**(r+1))/(1-(1-theta)) # plot plt.bar(r,sum_y, color='r',label='cumulative income') plt.bar(r,y, color='b', label='spending round income') plt.grid() plt.legend(loc='center right') plt.xlabel('Spending round, n') plt.ylabel('Income') plt.tight_layout() plt.show()