feat: chain rule

This commit is contained in:
2025-11-16 19:23:59 +01:00
parent 1fb7616c93
commit cb3915b405
2 changed files with 27 additions and 1 deletions

View File

@@ -55,6 +55,17 @@ def t_calculate_e_limit():
def t_calculate_derivative(f, x, step_size):
return (f(x + step_size) - f(x)) / (x +step_size - x)
def t_build_derivative_from_limit(f):
x, s = symbols("x s")
slope_f = (f.subs(x, x + s) - f) / (x + s - x) # Slope function
return limit(slope_f, s, 0)
def t_calculate_derivative_limit(f, x_target):
x = symbols("x")
slope_f = t_build_derivative_from_limit(f)
return slope_f.subs(x, x_target)
def t_build_derivate(f):
return diff(f)