Skip to content

Commit

Permalink
add documentation for simple interest use case
Browse files Browse the repository at this point in the history
  • Loading branch information
genedan committed Jul 28, 2020
1 parent 56cc496 commit a8d2628
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions docs/usage/growth/simple.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
========================
Simple Interest
========================
Simple interest is a pattern of money growth in which the value of money increases at a linear rate:

.. math::
a(t) = 1 + st
where :math:`a(t)` refers to the value of 1 dollar (or other unit of currency) after time :math:`t`, at interest rate `s`. For example, $1 that grows at 5% simple interest is expected to grow to $1.05 after 1 year:

.. math::
a(1) = 1 + (.05)(1) = 1.05.
For quantities of money larger than dollar, we can express growth as:

.. math::
A_K(t) = K(1 + st)
Where :math:`K` refers to the initial amount, or **principal**. For example, if we start with $5 and an interest rate of 5%, it should grow to $5.25 after one year:

.. math::
A_K(1) = 5(1 + (.05)(1)) = 5.25
Examples
========================

Let's repeat the above examples using the TmVal package. Let's start by importing SimpleAmt, which is a class that can be used for simple interest calculations:

.. ipython:: python
from tmval import SimpleAmt
Let's see how much $1 grows to after 1 year, at an interest rate of 5%:

.. ipython:: python
my_amt = SimpleAmt(k=1, s=.05)
print(my_amt.val(1))
Now, let's change the principal to $5:

.. ipython:: python
my_amt = SimpleAmt(k=5, s=.05)
print(my_amt.val(1))
The output is 5.25, the same as above.

TmVal also comes with a simple interest solver that can be used to solve for missing inputs. For example, what rate of interest would give us $5.25, if we held $5 for a year?

.. ipython:: python
from tmval import get_simple_amt
my_amt = get_simple_amt(fv=5.25, interest=.05, n=1)
print(my_amt.interest_rate)

0 comments on commit a8d2628

Please sign in to comment.