domingo, 21 de julio de 2019

Compound Interest: Calculations and Program in Python

Compound Interest: Calculations and Program in Python
 (2) Notes of the Financial Mathematics Course


1. Basic principles

In the chapter on Simple Interest, we explain the concept of opportunity cost as justification for the existence of interest as compensation for using money received by third parties (loan or debt) or for depositing savings (leaving the money in a bank for an agreed term) . All considerations are the same in the case of compound interest; The difference is in the way interests are treated over time.
Suppose a loan is requested that must be repaid within four years at an annual interest rate. The interest (I = C * i * n) of the first year is calculated with the formula 

  I 1 = C * i * 1 = C * iy at the end of the first year they are added to the capital, or principal of the debt, that is to say, they capitalize and at the end of the year the debt becomes

C 1 = C + I1 = C + C * i = C (1 + i).

For the next period, the interest will be higher because it is calculated on a larger capital. That is, I2 = C1 * i * 1 = C1 * i. The new capital at the end of period 2 will be

C 2 = C1 + I2 = C (1 + i) + C (1 + i) * i = C (1 + i) (1 + i) = C (1 + i) ^ 2
At the end of Period 4, the term of the loan, the capital or amount that must be repaid is M = C4 = C (1 + i) ^ 4

With the same data, the amount or amount of compound interest is greater than that corresponding to simple interest.

2. Compound interest. Formulas

Interest I for each period depends proportionally on capital, rate and time

I = C * i * n = C * i * 1 = C * i

Where: C = Capital or principal (in monetary units)
 i = interest rate (percentage, without units)
 n = time (years or any other period of time)

For period 1 we have:

I1 = C * i * n = C * i * 1 = C * i        Interest for period 1
C1 = C + I1 = C + C (1 + i) = C (1 + i)    Capital accumulated in period 1

For period 2

 I2 = C1 * i * n = C1 * i * 1 = C1 * i = C (1 + i) * i        Interest for period 2
C2 = C1 + I2 = C1 (1 + i) + C1 (1 + i) * i = C1 (1 + i) (* (1 + i) = C (1 + i) ^ 2
Capital accumulated in period 2 (The sign ^ indicates power)

For period 3

I3 = C2 * i * n = C2 * i * 1 = C2 * i = C (1 + i) ^ 2 * i     Interest for period 3
C3 = C2 + I3 = C (1 + i) ^ 2 + C (1 + i) ^ 2 * i
    = C (1 + i) ^ 2 * (1 + i) = C (1 + i) ^ 3
Capital accumulated in period 3

For period n, generalizing we have:

In = C (n-1) * i * n = C (n-1) * i * 1 = C (n-1) * i = C (1 + i) ^ (n-1) * i Interest for the period n-esimo
Cn = C (n-1) + In = C (1 + i) ^ (n-1) + C (1 + i) ^ (n-1) * i
     = C (1 + i) ^ (n-1) ) * (1 + i) = C (1 + i) ^ n

The amount or amount that must be paid in period n with compound interest is:

M = Cn = C (1 + i) ^ n           (1)

As in the simple interest, there are two possibilities:

 1) A needs money, B provides the desired amount. A is a debtor (person or company) and B is a creditor or lender (Bank). After a period A, you must return the principal, principal or debt plus compound interest equivalent to the opportunity cost of the bank. The amount returned is called Amount, Amount:

M = C + I = C * (1 + i) ^ n = C * FCC (1)

Where: FCC = (1 + i) ^ n = Compound capitalization factor


2) A decides to save in a bank, in which he leaves his money for a time t and receives as compensation for his opportunity cost the rate of i per unit of time. The opportunity cost of the saver is in the renunciation of the use of the money while the bank can freely dispose of it for its own banking operations. In the end, the saver receives the deposited capital plus interest. Formula (1) is also applicable in this case.



3. Formulas derived from Compound Interest

Calculation of capital
C = M / FCC = M / (1 + i) ^ n = M * (1 + i) ^ (- n)

Calculation of time
M = C * (1 + i) ^ n
Log M = log C + n * log (1 + i)
Log M - log C = n * log (1 + i)
n = (log M - log C) / log (1 + i)

Calculation of the interest rate
(1 + i) ^ n = M / C
Here, Cn = M, if we take the nth root we have





4. Example

Juan saves 20,000 euros in the Trampitas bank for 4 years, at the compound rate of 5% per year. How much can you withdraw at the end of the term?

Amount M = C * (1+ i) ^ n = 20,000 * (1 + 5%) ^ 4 = 20,000 * (1.05) ^ 4 =  24,310.12 euros

Interest = M-C = 24,310.12 - 20,000 = 4,310.12 euros

It is important to check the coherence of units in the calculations. The interest rate (i) has no units, Interest (I) is expressed in monetary units.

5. Program in Python:



Recommended links: Simple interest

https://financial-math-easy.blogspot.com/2019/07/simple-interest-calculations-and.html

No hay comentarios:

Publicar un comentario