feat: main structure + basic math testing
This commit is contained in:
26
src/modules/math.py
Normal file
26
src/modules/math.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from cmath import log as complex_log # used for complex numbers
|
||||
from math import log
|
||||
|
||||
|
||||
def t_summ():
|
||||
# Equivalent to summatory of 2*i from i=1 to i=5
|
||||
return sum(2*i for i in range(1,6))
|
||||
|
||||
def t_exponent(base, exponent):
|
||||
return base**exponent
|
||||
|
||||
def t_logarithm(n, base):
|
||||
return log(n, base)
|
||||
|
||||
def t_complex_logarithm(n, base):
|
||||
return complex_log(n, base)
|
||||
|
||||
def t_compound_interest(input, interest, span, periods):
|
||||
return input * ((1 + (interest / periods))**(periods * span))
|
||||
|
||||
def t_compound_interest_algorigthm(input, interest, span, periods):
|
||||
result = input
|
||||
for _ in range(0, span):
|
||||
for _ in range(0, periods):
|
||||
result += result * (interest / periods)
|
||||
return result
|
||||
Reference in New Issue
Block a user