feat: a little more math

This commit is contained in:
2025-11-15 14:08:20 +01:00
parent 90f0e44e22
commit 83723d1db7
5 changed files with 60 additions and 2 deletions

View File

@@ -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)