Skip to content

Commit

Permalink
add terms to glossary, closes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
genedan committed Jul 31, 2020
1 parent dc530ad commit 6475711
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 31 deletions.
42 changes: 41 additions & 1 deletion docs/glossary.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
========================
Glossary
========================
========================

.. glossary::

accumulation function
A function that describes how much as single unit of currency grows over time. It is a special case of the amount function, where the amount invested is restricted to be one unit of currency.

amount function
A function that describes how much an invested amount of money grows over time.

compound interest
A geometric pattern of money growth in which interest earned is reinvested at the rate of interest.

discount
The amount of money that must be paid up front on a loan.

effective rate of interest
A measurement of money growth equal to the percentage change in the value of an investment between two time periods:

.. math::
i_{[t_1, t_2]} = \frac{a(t_2) - a(t_1)}{a(t_1)}
growth
The change in the value of money over time.

interest earned
A measurement of money growth equal to the change in the value of an investment between two time periods:

.. math::
A_K(t_2) - A_K(t_1).
principal
(1) An initial investment of money.
(2) The original amount of a loan that must be paid back.

simple interest
A linear pattern of money growth in which interest earned is a fixed amount per time period.


10 changes: 5 additions & 5 deletions docs/usage/growth/accumulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Accumulation Functions
========================

The accumulation function is a special case of the amount function where :math:`K=1`:
The :term:`accumulation function` is a special case of the amount function where :math:`K=1`:

.. math::
a(t) = A_1(t)
Expand All @@ -18,14 +18,14 @@ The amount and accumulation functions are often related by the following express
Examples
========================

TmVal's **Accumulation** class models accumulation functions.
TmVal's ``Accumulation`` class models accumulation functions.

Suppose money exhibits a quadratic growth pattern, specified by the amount function:

.. math::
a(t) = .05t^2 + .05t + 1
How much does $1 invested at time 0 grow to at time 5? To solve this problem, we import the Accumulation class, supply the growth function in a similar manner as we had done with the Amount class, except we do not need to supply a value for :math:`K`.
How much does $1 invested at time 0 grow to at time 5? To solve this problem, we import the ``Accumulation class``, supply the growth function in a similar manner as we had done with the ``Amount`` class, except we do not need to supply a value for :math:`K`.

.. ipython:: python
Expand All @@ -38,7 +38,7 @@ How much does $1 invested at time 0 grow to at time 5? To solve this problem, we
print(my_acc.val(5))
Note that we could have also solved this problem with the Amount class, by setting :math:`K=1`.
Note that we could have also solved this problem with the ``Amount`` class, by setting :math:`K=1`.

.. ipython:: python
Expand All @@ -51,7 +51,7 @@ Note that we could have also solved this problem with the Amount class, by setti
print(my_amt.val(5))
If the amount and accumulation functions are proportionally related, we can extract the accumulation function from the Amount class by calling the **get_accumulation()** method, which returns an Accumulation class derived from the Amount class:
If the amount and accumulation functions are proportionally related, we can extract the accumulation function from the ``Amount`` class by calling the ``get_accumulation()`` method, which returns an ``Accumulation`` class derived from the ``Amount`` class:

.. ipython:: python
Expand Down
6 changes: 3 additions & 3 deletions docs/usage/growth/amount.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Amount Functions

Although we have introduced the familiar cases of simple and compound interest, not all growth patterns are linear or geometric. Sometimes a growth pattern might be geometric, cubic, or some arbitrary user-defined pattern.

To accommodate these new patterns, we can define an **amount function**, which specifies how money grows for an arbitrary growth pattern:
To accommodate these new patterns, we can define an :term:`amount function`, which specifies how money grows for an arbitrary growth pattern:

.. math::
A_K(t)
Expand All @@ -21,7 +21,7 @@ Suppose money exhibits a quadratic growth pattern, specified by the amount funct
If we invest :math:`K=5` at time 0, how much does it grow to at time 5?

TmVal's *Amount* class allows us to model this behavior. To solve the above problem, simply call the class and supply the growth function and principal. First, define the growth function as a Python function that takes the time and principal as arguments:
TmVal's ``Amount`` class allows us to model this behavior. To solve the above problem, simply call the class and supply the growth function and principal. First, define the growth function as a Python function that takes the time and principal as arguments:

.. ipython:: python
Expand All @@ -30,7 +30,7 @@ TmVal's *Amount* class allows us to model this behavior. To solve the above prob
def f(t, k):
return k * (.05 * (t **2) + .05 * t + 1)
Now supply the growth_function to the Amount class, and call :code:`my_amt.val(5)` to get the answer:
Now supply the growth function to the ``Amount`` class, and call :code:`my_amt.val(5)` to get the answer:

.. ipython:: python
Expand Down
8 changes: 4 additions & 4 deletions docs/usage/growth/compound.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Compound Interest
========================

Compound interest is a pattern of money growth in which the value of money increases at a geometric rate:
:term:`Compound interest<compound interest>` is a pattern of money growth in which the value of money increases at a geometric rate:

.. math::
Expand All @@ -20,7 +20,7 @@ For quantities of money larger than dollar, we can express growth as:
A_K(t) = K(1 + i)^t
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.5125 after two years:
Where :math:`K` refers to the initial amount, or :term:`principal`. For example, if we start with $5 and an interest rate of 5%, it should grow to $5.5125 after two years:

.. math::
Expand All @@ -29,7 +29,7 @@ Where :math:`K` refers to the initial amount, or **principal**. For example, if
Examples
========================

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

.. ipython:: python
Expand All @@ -52,7 +52,7 @@ Now, let's change the principal to $5:
The output is 5.5125, the same as above.

TmVal also comes with a compound interest solver that can be used to solve for missing inputs. For example, what rate of interest would give us $5.5125, if we held $5 for two years?
TmVal also comes with a compound interest solver, ``compound_solver()``, that can be used to solve for missing inputs. For example, what rate of interest would give us $5.5125, if we held $5 for two years?

.. ipython:: python
Expand Down
18 changes: 9 additions & 9 deletions docs/usage/growth/interest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
Interest
========================

Suppose we invest :math:`K` at time 0. We define the amount of interest earned between times :math:`t_1` and :math:`t_2` as:
Suppose we invest :math:`K` at time 0. We define the amount of :term:`interest earned` between times :math:`t_1` and :math:`t_2` as:

.. math::
A_K(t_2) - A_K(t_1).
We define the effective rate of interest for the interval as:
We define the :term:`effective rate of interest` for the interval as:

.. math::
Expand All @@ -28,14 +28,14 @@ To examine the effective interest rate for a single time period, the :math:`n`-t
Examples
========================

We can use the **Amount** class to make various interest calculations. For example, assume the following amount function:
We can use the ``Amount`` class to make various interest calculations. For example, assume the following amount function:

.. math::
A_K(t) = K(.02t^2 + .02t + 1)
If we invest $5 at time 0, What is the interest earned during the 5th time period?

First lets set up our Amount instance:
First lets set up our ``Amount`` instance:

.. ipython:: python
Expand All @@ -46,31 +46,31 @@ First lets set up our Amount instance:
my_amt = Amount(f=f, k=5)
We can use the Amount class's **interest_earned()** method to get the answer:
We can use the ``Amount`` class's ``interest_earned()`` method to get the answer:

.. ipython:: python
interest = my_amt.interest_earned(t1=4, t2=5)
print(interest)
What is the effective interest rate during the 5th time period? We can use the Amount class's **effective_rate()** method to get the answer:
What is the effective interest rate during the 5th time period? We can use the ``Amount`` class's ``effective_rate()`` method to get the answer:

.. ipython:: python
eff_interest_rate_amt = my_amt.effective_rate(n=5)
print(eff_interest_rate_amt)
We can also use the **effective_interval()** method to find the effective rate over a longer interval, say from times 1 to 5:
We can also use the ``effective_interval()`` method to find the effective rate over a longer interval, say from times 1 to 5:

.. ipython:: python
eff_interval_rate_amt = my_amt.effective_interval(t1=1, t2=5)
print(eff_interval_rate_amt)
TmVal's **Accumulation** class is a subclass of the **Amount** class. This means that many of the methods that can be used from the Amount class can also be used by the Accumulation class.
TmVal's ``Accumulation`` class is a subclass of the ``Amount`` class. This means that many of the methods that can be used from the ``Amount`` class can also be used by the ``Accumulation`` class.

Assuming proportionality, we can define an amount function from an accumulation function and then get the effective interest rate for the 5th interval. It should be the same answer as that achieved from the amount function:

Expand All @@ -86,4 +86,4 @@ Assuming proportionality, we can define an amount function from an accumulation
print(math.isclose(eff_interest_rate_acc, eff_interest_rate_amt, rel_tol=.0001))
Note that there is some loss of precision due to floating point operations, so we use **isclose()** from the **math** library for the comparison.
Note that there is some loss of precision due to floating point operations, so we use ``isclose()`` from the ``math`` library for the comparison.
8 changes: 4 additions & 4 deletions docs/usage/growth/reminder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
A Friendly Reminder
========================

If you have read the last couple sections on accumulation and amount functions, you may wonder why we have to define a growth function prior to defining an Amount or Accumulation class. After all, this seems cumbersome and it would be more convenient to simply create an Amount or Accumulation class by specifying an interest rate.
If you have read the last couple sections on accumulation and amount functions, you may wonder why we have to define a growth function prior to defining an ``Amount`` or ``Accumulation`` class. After all, this seems cumbersome and it would be more convenient to simply create an ``Amount`` or ``Accumulation`` class by specifying an interest rate.

The good news is, we can actually do this! If you recall at the beginning of the tutorial, TmVal provided a pair of classes called :code:`CompoundAmt` and :code:`CompoundAcc`. These are subclasses of the Amount and Accumulation classes, respectively, and can be called without having to specify a separate growth function, and have access to the methods in their parent classes.
The good news is, we can actually do this! If you recall at the beginning of the tutorial, TmVal provided a pair of classes called ``CompoundAmt`` and ``CompoundAcc``. These are subclasses of the Amount and Accumulation classes, respectively, and can be called without having to specify a separate growth function, and have access to the methods in their parent classes.

For example, if money grows at a compound rate of 5%, we can define an accumulation class with a single argument, and see what value it accumulates to after 5 years:

Expand All @@ -16,6 +16,6 @@ For example, if money grows at a compound rate of 5%, we can define an accumulat
print(my_acc.val(5))
In the case of simple interest, TmVal offers the companion classes, :code:`SimpleAmt` and :code:`SimpleAcc`.
In the case of simple interest, TmVal offers the companion classes, ``SimpleAmt`` and ``SimpleAcc``.

The :code:`Amount` and :code:`Accumulation` classes are for generalized cases that cannot be handled by the compound and simple classes. In these cases, you can define your own growth pattern.
The ``Amount`` and ``Accumulation`` classes are for generalized cases that cannot be handled by the compound and simple classes. In these cases, you can define your own growth pattern.
8 changes: 4 additions & 4 deletions docs/usage/growth/simple.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
========================
Simple Interest
========================
Simple interest is a pattern of money growth in which the value of money increases at a linear rate:
:term:`Simple interest<simple interest>` is a pattern of money growth in which the value of money increases at a linear rate:

.. math::
Expand All @@ -19,7 +19,7 @@ For quantities of money larger than dollar, we can express growth as:
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:
Where :math:`K` refers to the initial amount, or :term:`principal`. For example, if we start with $5 and an interest rate of 5%, it should grow to $5.25 after one year:

.. math::
Expand All @@ -28,7 +28,7 @@ Where :math:`K` refers to the initial amount, or **principal**. For example, if
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:
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
Expand All @@ -51,7 +51,7 @@ Now, let's change the principal to $5:
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?
TmVal also comes with a simple interest solver, ``get_simple_amt()`` 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
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/growth/tiered.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TmVal's :code:`TieredBal` class offers a way to model this type of account. You
rates=[.01, .02, .03]
)
:code:`TieredBal` is a growth pattern that can be supplied to the :code:`Amouunt` class, which you can then use to access its methods. If we invest 18000 today, to what value does it grow after 10 years?
:code:`TieredBal` is a growth pattern that can be supplied to the :code:`Amount` class, which you can then use to access its methods. If we invest 18000 today, to what value does it grow after 10 years?

.. ipython:: python
Expand Down

0 comments on commit 6475711

Please sign in to comment.