Annuity Discounting
Let’s visualize what the value of each payment is with the different rates to understand this better. If we assume payments are \$100 we can iterate through each rate to see the values.
In [8]:
P = 100
n = 10
rates = [0, .02, .05, .1]
PV = []
for r in rates:
PV.append([P / (1 + r) ** t for t in range(1, n+1)])
print("r={}".format(r))
print("Payment Values:")
print(PV[-1])
print()
Now that we have the data, we can plot it.
In [9]:
plt.rcParams["figure.figsize"] = [8,6]
#And now, let's graph them
for payments, r in zip(PV, rates):
#Use "o" so we get points instead of a line
plt.plot(list(range(1,n+1)), payments, "o", label="r="+str(r))
#Set the limits so that we have 0 as the left minimum and 5.5 as the right (so we don't cut off points)
plt.xlim([0,10.5])
plt.ylim([0,110])
plt.xlabel("t")
plt.ylabel("Payment PV")
plt.title("Present Value of Annuity Payments")
plt.legend()
plt.show()
Of course, we can sum these values to find the annuity present value. Let's see how they compare below.
In [10]:
#Iterate through and find the present values
for r, payments in zip(rates, PV):
print("r={}".format(r))
print("Payment Values: {}".format(sum(payments)))
print()
In [11]:
for r, payments in zip(rates, PV):
print("r={}".format(r))
#If r is 0 then there will be division by 0
#Formula is n*payment in that case
if r > 0:
print("Payment Values: {}".format(annuity_TVM(100,10,r)))
else:
print("Payment Values: {}".format(10 * 100))
print()