-
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
-
Interest with Withdrawals
The Effect of Withdrawal¶
If there are withdrawals the effects may become interesting. In the case that withdrawls outpace the interest earned, we may eventually get to the point where there is no money left.
In [10]:
def compound_interest_withdrawal(P, rates, withdrawal):
A = P
A_list = [A]
for r in rates:
#Accrue the interest
A = (1 + r) * A
#Withdraw the cash, but only if there is enough
A = max(A - withdrawal, 0)
A_list.append(A)
return A_list
rates = [.02] * 30
A_list = compound_interest_withdrawal(100000, rates, 7000)
print(A_list)
[100000, 95000.0, 89900.0, 84698.0, 79391.96, 73979.79920000001, 68459.39518400001, 62828.58308768, 57085.154749433605, 51226.85784442228, 45251.395001310724, 39156.42290133694, 32939.55135936368, 26598.342386550954, 20130.309234281973, 13532.915418967612, 6803.573727346964, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
In [11]:
plt.plot(years, A_list)
plt.xlabel("Year")
plt.ylabel("Account Value")
plt.title("Account Value with Withdrawals")
plt.show()
In [12]:
rates_l = [[.02] * 30,
[.07] * 30,
[.09] * 30]
A_list = []
for rates in rates_l:
A_list.append(compound_interest_withdrawal(100000, rates, 7000))
print(A_list)
[[100000, 95000.0, 89900.0, 84698.0, 79391.96, 73979.79920000001, 68459.39518400001, 62828.58308768, 57085.154749433605, 51226.85784442228, 45251.395001310724, 39156.42290133694, 32939.55135936368, 26598.342386550954, 20130.309234281973, 13532.915418967612, 6803.573727346964, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [100000, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0, 100000.0], [100000, 102000.00000000001, 104180.00000000003, 106556.20000000004, 109146.25800000006, 111969.42122000008, 115046.6691298001, 118400.8693514821, 122056.9475931155, 126042.07287649592, 130385.85943538055, 135120.5867845648, 140281.43959517565, 145906.76915874146, 152038.3783830282, 158721.83243750077, 166006.79735687585, 173947.4091189947, 182602.67593970423, 192036.91677427763, 202320.23928396264, 213529.0608195193, 225746.67629327605, 239063.8771596709, 253579.6261040413, 269401.79245340504, 286647.9537742115, 305446.26961389056, 325936.4338791407, 348270.7129282634, 372615.07709180715]]
In [13]:
plt.plot(years, A_list[0])
plt.plot(years, A_list[1])
plt.plot(years, A_list[2])
plt.xlabel("Year")
plt.ylabel("Account Value")
plt.title("Account Value with Withdrawals")
plt.legend(["r=2%", "r=7%", "r=9%"])
plt.show()
The Importance of Timing¶
In [14]:
rates_l = [[.07] * 30,
[.10] * 15 + [.04] * 15,
[.04] * 15 + [.10] * 15]
A_list = []
for rates in rates_l:
A_list.append(compound_interest_withdrawal(100000, rates, 7000))
plt.plot(years, A_list[0])
plt.plot(years, A_list[1])
plt.plot(years, A_list[2])
plt.xlabel("Year")
plt.ylabel("Account Value")
plt.title("Account Value with Withdrawals")
plt.legend(["r=2%", "r=7%", "r=9%"])
plt.show()
Prev
Changing r