feat: math chapter done + editorconfig + remove pycache

This commit is contained in:
2025-11-17 02:33:06 +01:00
parent cb3915b405
commit ac1ddfb98b
6 changed files with 93 additions and 47 deletions

View File

@@ -1,55 +1,13 @@
from sympy import diff, limit, oo, symbols
from modules.math import (
t_build_derivate,
t_build_derivative_from_limit,
t_build_partial_derivate,
t_calculate_derivative_limit,
t_calculate_e,
t_calculate_e_limit,
t_compound_interest,
t_compound_interest_algorigthm,
t_compound_interest_continious,
t_compound_interest_continious_exp,
t_exponent,
t_limit,
t_logarithm_natural,
test_math_module
)
from modules.strings import t_strings
if __name__=="__main__":
t_strings()
t_exponent(2,8)
print(t_compound_interest(100, 20 / 100, 2, 12))
print(t_compound_interest_algorigthm(100, 20 / 100, 2, 12))
print(t_compound_interest_continious(100, 20 / 100, 2))
print(t_compound_interest_continious_exp(100, 20 / 100, 2))
print(t_calculate_e(1000000000000))
print(t_logarithm_natural(10))
print(t_limit())
print(t_calculate_e_limit())
print(t_calculate_e_limit().evalf())
x = symbols("x")
derivative = t_build_derivate(x ** 2)
value_on_two = derivative.subs(x,2)
print(derivative, value_on_two)
# Partial derivates are applied to one variable at a time
y = symbols("y")
z = symbols("z")
partial_derivative_y = t_build_partial_derivate((3 * y ** 3) + 2 * z ** 2, y)
partial_derivative_z = t_build_partial_derivate((3 * y ** 3) + 2 * z ** 2, z)
print(partial_derivative_y, partial_derivative_z)
print(t_build_derivative_from_limit(x ** 2))
print(t_calculate_derivative_limit(x ** 2, 2))
## Chain rule
# for a given function y (lets say y = x ** 2 + 1) and another z (lets say z = y ** 3 - 2), we can find a derivativeof z with respect to x by multiplying the derivatives
# normal derivative calc
x = symbols("x")
z = (x ** 2 + 1) ** 3 - 2
print(t_build_derivate(z))
# chain rule calc
x, y, z = symbols("x y z")
y_f = x ** 2 + 1
z_f = y ** 3 - 2
print(t_build_derivate(y_f), t_build_derivate(z_f))
print(">> Math module")
test_math_module()
print(">>>>>>>>>>>>>>>>>>>>")