Teaching Kids Programming – Compound Interests and Euler’s number (Math Constant E) | ninjasquad

**Teaching Kids Programming**: Videos on **Data Structures and Algorithms**

https://www.youtube.com/watch?v=j5v27O8A0eU

Suppose you have deposited $1 into the bank account, and if the interest rate is 100% (AER = Annual Equivalent Rate).

If the interests are paid out once yearly, together with $1 (your initial money, also called principal balance), you will have $1+$1=$2.

However, if the interests are paid out twice e.g. every 6 months, you will get slightly more: the interests earned at first 6 months contribute to the principal balance in the second 6 months.

If we tend to increase the number of interests paid, we tend to get a larger overall payout (principal and the accumulated interests), however, this does not grow unbounded – in fact, it converges.

The Compound Interests (after a year) can be calculated as:

where:

is the total amount of money you will get, which includes pricipal P and compound interests earned.

is the principal balance aka the initial money deposited.

is the interest rate (AER).

is the number of interests applied over the period e.g. 1 year.

Translated to Python function:

1 2 |
def A(P, I, n): return P * (1 + I/n) ** n |

def A(P, I, n): return P * (1 + I/n) ** n

When P=1, I=1 (100%), and n goes to infinity – the A approaches (has a limit of) the Euler’s number – e, the math constant which is roughly, (irrelational number).

–EOF (The Ultimate Computing & Technology Blog) —

**GD Star Rating***loading…*

700 words

**Last Post**: Teaching Kids Programming – Minimum Genetic Mutation via Iterative Deepening Search Algorithm

Source: Internet