-
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
-
Basics
While you can loop through every year to determine the ending value, there is also a simple formula which can calculate at each point in time what the value of the account should be. This formula is:
$ A = P * (1+r)^t $
where
$ A = \text{Ending value of the account} $
$ P = \text{Starting principal of the account} $
$ r = \text{Annual rate of return} $
$ t = \text{Number of years} $
In [4]:
p = 100
r = .05
for t in range(1,6):
A = p * (1+r) ** t
print("----Year {}----".format(t))
print("Ending Principal: ${}".format(A))
print("---------------")
print()
print()
----Year 1----
Ending Principal: $105.0
---------------
----Year 2----
Ending Principal: $110.25
---------------
----Year 3----
Ending Principal: $115.76250000000002
---------------
----Year 4----
Ending Principal: $121.55062500000003
---------------
----Year 5----
Ending Principal: $127.62815625000003
---------------
To make our life easy, let's create a function that will compute the future value of an investment and then check to make sure it works.
In [5]:
def compoundInterest(p,r,t):
A = p*(1+r)**t
return A
p = 100
r = .05
for t in range(1,6):
A = compoundInterest(p,r,t)
print("----Year {}----".format(t))
print("Ending Principal: ${}".format(A))
print("---------------")
print()
print()
----Year 1----
Ending Principal: $105.0
---------------
----Year 2----
Ending Principal: $110.25
---------------
----Year 3----
Ending Principal: $115.76250000000002
---------------
----Year 4----
Ending Principal: $121.55062500000003
---------------
----Year 5----
Ending Principal: $127.62815625000003
---------------
Prev
Introduction