Rule of 72 – Useful code


Ever heard of the Rule of 72? It’s a classic finance shortcut that tells you how many years it takes for an investment to double at a given interest rate—without reaching for a calculator! Pretty much, if you want to understand when you are going to double your money, that are growing with 7% per year, then simply divide 72 by 7 and see the approximate answer. It works like that and it is approximately ok, for values between 5 and 10%.

For all other values, the formula looks like this:

ln(2) is approximately 0.693. Hence, it is 0.693 divided by ln(1+tiny percentage).

With Python the formula looks like this:

If you want to see how exact the formula is, then a good comparison vs the exact value looks like this:

The execution of the code from above like this:

The YT video, explaining the code and is here:

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

The GitHub code is here: https://github.com/Vitosh/Python_personal/tree/master/YouTube/023_Python-Rule-of-72

A nice picture from Polovrak Peak, Bulgaria

Enjoy!



Source link

دیدگاه‌ها

دیدگاهتان را بنویسید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *