Skip to content

Instantly share code, notes, and snippets.

@siddjain
Created November 10, 2019 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siddjain/91d548c3104f6c5c6910b26e00560796 to your computer and use it in GitHub Desktop.
Save siddjain/91d548c3104f6c5c6910b26e00560796 to your computer and use it in GitHub Desktop.
import math
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
def breakeven(r,t,N):
r2=(1-t)*r
x=(1+r2)/(1+r)
return np.power(x,N)*t
N = np.arange(1,35,1)
y = breakeven(0.08,0.37,N)
y2 = breakeven(0.08,0.22,N)
matplotlib.rc('xtick', labelsize=20)
matplotlib.rc('ytick', labelsize=20)
font = {'family' : 'normal',
'weight' : 'bold',
'size' : 22}
matplotlib.rc('font', **font)
fig, ax = plt.subplots()
ax.plot(N,y,linewidth=3,label="$t_1=0.37$")
ax.plot(N,y2,linewidth=3,label="$t_1=0.22$")
ax.set_xlim(35, 0) # decreasing time
ax.set(xlabel="years to retire (N)", ylabel="lower bound on $t_2$ to make Roth more preferable")
ax.xaxis.label.set_fontsize(30)
ax.yaxis.label.set_fontsize(26)
ax.grid()
plt.legend(loc='best')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment