Accumulation Functions¶
The accumulation function is a special case of the amount function where :
It is often convenient to use this form to explore the growth of money without having to bother with the principal.
The amount and accumulation functions are often related by the following expression:
Examples¶
TmVal’s Accumulation
class models accumulation functions.
Suppose money exhibits a quadratic growth pattern, specified by the amount function:
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 .
In [1]: from tmval import Accumulation
In [2]: def f(t):
...: return .05 * (t **2) + .05 * t + 1
...:
In [3]: my_acc = Accumulation(gr=f)
In [4]: print(my_acc.val(5))
2.5
Note that we could have also solved this problem with the Amount
class, by setting .
In [5]: from tmval import Amount
In [6]: def f(t, k):
...: return k * (.05 * (t **2) + .05 * t + 1)
...:
In [7]: my_amt = Amount(gr=f, k=1)
In [8]: print(my_amt.val(5))
2.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:
In [9]: from tmval import Amount
In [10]: def f(t, k):
....: return k * (.05 * (t **2) + .05 * t + 1)
....:
In [11]: my_amt = Amount(gr=f, k=1)
In [12]: my_acc = my_amt.get_accumulation()
In [13]: print(my_acc.val(5))
2.5