feat: a little more math
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
from cmath import log as complex_log # used for complex numbers
|
||||
from math import log
|
||||
from math import e, exp, log
|
||||
|
||||
# Sympy is powerful since it does not make aproximations, it keeps every primitive as it is, this means that it's slower but more precisse
|
||||
from sympy import limit, oo, symbols
|
||||
|
||||
|
||||
def t_summ():
|
||||
@@ -24,3 +27,26 @@ def t_compound_interest_algorigthm(input, interest, span, periods):
|
||||
for _ in range(0, periods):
|
||||
result += result * (interest / periods)
|
||||
return result
|
||||
|
||||
def t_compound_interest_continious(input, interest, span):
|
||||
return input * (e ** (interest * span))
|
||||
|
||||
def t_compound_interest_continious_exp(input,interest, span):
|
||||
return input * exp(interest * span)
|
||||
|
||||
def t_calculate_e(precission):
|
||||
return (1 + 1 / precission) ** precission
|
||||
|
||||
def t_logarithm_natural(value):
|
||||
return log(value) # The default base is e
|
||||
|
||||
def t_limit():
|
||||
x = symbols("x")
|
||||
f = 1 / x
|
||||
result = limit(f, x, oo)
|
||||
return result
|
||||
|
||||
def t_calculate_e_limit():
|
||||
x = symbols("x")
|
||||
f = (1 + 1 / x) ** x
|
||||
return limit(f, x, oo)
|
||||
|
||||
Reference in New Issue
Block a user