Teaching Kids Programming: Videos on Data Structures and Algorithms
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
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:
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,
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Teaching Kids Programming - Minimum Genetic Mutation via Iterative Deepening Search Algorithm
Next Post: Teaching Kids Programming - Minimum Sum of Four Digit Number After Splitting Digits