Skip to content

Commit cae95da

Browse files
committed
added more funcs
1 parent 5dc967e commit cae95da

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Economics/functions.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,31 +64,38 @@ def series_P ( O , i , n , forward = True ) -> float:
6464

6565
def arith_grad_series ( O , i , n , forward = True ) -> float:
6666
"""
67-
Calculates the worth of n 'payments' of O at some other time, either worth at time of 'payment' (when forward == True, which gives O == P, Z == A);
68-
else a present worth - i.e. O == A, Z == P.
67+
TODO (need to think)
6968
INPUT:
7069
O : numerical - the known variable, either G - the gradient factor if forward == True, else A - the worth of each payment at the time of payment
7170
i : numerical - the interest rate
7271
n : int - the number of periods the interest compounds
7372
forward : bool - the direction of worth to be calculated, defaults to True
7473
RETURN:
7574
Z : numerical - G( ( 1 / i ) - n / ( ( 1 + i )^n - 1 ) ), the neccessary value of A
76-
else A/( ( 1 / i ) - n / ( ( 1 + i )^n - 1 ) ), the gradient value.
75+
else A/( ( 1 / i ) - n / ( ( 1 + i )^n - 1 ) ), the gradient value G.
7776
"""
7877
return O * ( ( 1 / i ) - n / ( ( 1 + i ) ** n - 1 ) ) if forward else O / ( ( 1 / i ) - n / ( ( 1 + i ) ** n - 1 ) )
7978

8079

8180
def arith_grad_worth ( O , i , n , forward = True ) -> float:
8281
"""
83-
Calculates the worth of n 'payments' of O at some other time, either worth at time of 'payment' (when forward == True, which gives O == P, Z == A);
84-
else a present worth - i.e. O == A, Z == P.
82+
TODO (need to think)
8583
INPUT:
8684
O : numerical - the known variable, either G - the gradient factor if forward == True, else A - the worth of each payment at the time of payment
8785
i : numerical - the interest rate
8886
n : int - the number of periods the interest compounds
8987
forward : bool - the direction of worth to be calculated, defaults to True
9088
RETURN:
91-
Z : numerical - G( ( 1 / i ) - n / ( ( 1 + i )^n - 1 ) ), the neccessary value of A
92-
else A/( ( 1 / i ) - n / ( ( 1 + i )^n - 1 ) ), the gradient value.
89+
Z : numerical - G( ( ( 1 + i )^n - i * n - 1 ) / ( ( i^2 ) * ( 1 + i )^n ) ), the present worth P
90+
else P/( ( ( 1 + i )^n - i * n - 1 ) / ( ( i^2 ) * ( 1 + i )^n ) ), the gradient value G.
9391
"""
94-
return O * ( ( 1 / i ) - n / ( ( 1 + i ) ** n - 1 ) ) if forward else O / ( ( 1 / i ) - n / ( ( 1 + i ) ** n - 1 ) )
92+
return O * ( ( ( 1 + i ) ** n - i * n - 1 ) / ( ( i ** 2 ) * ( 1 + i ) ** n ) ) if forward else O / ( ( ( 1 + i ) ** n - i * n - 1 ) / ( ( i ** 2 ) * ( 1 + i ) ** n ) )
93+
94+
95+
96+
97+
98+
99+
100+
101+

Economics/objects.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@
44
class Currency:
55

66
pass
7+
8+
9+
class USD ( Currency ):
10+
pass

0 commit comments

Comments
 (0)