-
Compound Interest Part 1 6
-
Lecture1.1
-
Lecture1.2
-
Lecture1.3
-
Lecture1.4
-
Lecture1.5
-
Lecture1.6
-
-
Compound Interest Part 2 3
-
Lecture2.1
-
Lecture2.2
-
Lecture2.3
-
-
Present Value 4
-
Lecture3.1
-
Lecture3.2
-
Lecture3.3
-
Lecture3.4
-
-
Annuities 6
-
Lecture4.1
-
Lecture4.2
-
Lecture4.3
-
Lecture4.4
-
Lecture4.5
-
Lecture4.6
-
-
Perpetuities 2
-
Lecture5.1
-
Lecture5.2
-
-
Bonds 6
-
Lecture6.1
-
Lecture6.2
-
Lecture6.3
-
Lecture6.4
-
Lecture6.5
-
Lecture6.6
-
-
Dividend Discount Model 3
-
Lecture7.1
-
Lecture7.2
-
Lecture7.3
-
-
Risk 8
-
Lecture8.1
-
Lecture8.2
-
Lecture8.3
-
Lecture8.4
-
Lecture8.5
-
Lecture8.6
-
Lecture8.7
-
Lecture8.8
-
-
Capital Asset Pricing Model 6
-
Lecture9.1
-
Lecture9.2
-
Lecture9.3
-
Lecture9.4
-
Lecture9.5
-
Lecture9.6
-
More Plotting
While this course is going to mainly focus on using built in python data structures, it is worthwile to start using numpy arrays because for our next task it will make life a lot easier. We are going to benchmark the other two rates to the first rate to see how much larger they grow to be as a multiple! First, import numpy and simply convert our lists.
import numpy as np
A1 = np.array(A1)
A2 = np.array(A2)
A3 = np.array(A3)
Numpy arrays support directly dividing one array by another. As long as the dimensions of them match up it will divide each i element in the first array by the i element in the second array. Let's make three benchmarked versions. Obviously, when benchmarking the first array to itself we expect it will simply all be equal to 1.
A1_bm = A1 / A1
A2_bm = A2 / A1
A3_bm = A3 / A1
print(A1_bm)
print()
print(A2_bm)
print()
print(A3_bm)
print()
[1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1.]
[1. 1.04761905 1.09750567 1.14976784 1.20451869 1.26187673
1.32196609 1.38491686 1.45086528 1.51995411 1.59233287 1.66815825
1.74759435 1.83081313 1.91799471 2.00932779 2.10501007 2.20524864
2.31026048 2.42027289 2.53552398 2.65626321 2.78275194 2.91526394
3.05408603 3.1995187 3.35187673 3.51148991 3.67870371 3.85388008
4.03739818]
[ 1. 1.0952381 1.19954649 1.31378901 1.43891177 1.57595099
1.72604156 1.89042647 2.07046708 2.26765442 2.48362151 2.72015689
2.97921946 3.26295464 3.57371223 3.91406577 4.28683394 4.69510384
5.14225659 5.63199531 6.16837581 6.75584018 7.39925353 8.10394434
8.87574856 9.72105795 10.64687299 11.6608609 12.77141908 13.9877447
15.31991087]
From this analysis, we can see that by the end of the 30 years, the account with r=10% is worth 3.04X more than the account that had r=5%. The account with r=15% has a huge difference from the r=5%, it is worth 14.32X more.
plt.plot(years, A1_bm, label="r=5%")
plt.plot(years, A2_bm, label="r=10%")
plt.plot(years, A3_bm, label="r=15%")
plt.xlabel("Year")
plt.ylabel("Relative Value Multiple")
plt.title("Benchmarked Account Values")
plt.legend()
plt.show()