Gova823 commited on
Commit
bfc5dfe
·
verified ·
1 Parent(s): 105119a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -43,7 +43,9 @@ def calculate_derivative(func_str):
43
  func = sp.sympify(func_str)
44
  # Calculate the derivative
45
  derivative = sp.diff(func, x)
46
- return func, derivative
 
 
47
  except sp.SympifyError:
48
  st.error("Invalid function input. Please enter a valid mathematical expression.")
49
  return None, None
 
43
  func = sp.sympify(func_str)
44
  # Calculate the derivative
45
  derivative = sp.diff(func, x)
46
+ func_lambdified = sp.lambdify(x, func, "numpy")
47
+ derivative_lambdified = sp.lambdify(x, derivative, "numpy")
48
+ return func_lambdified, derivative_lambdified
49
  except sp.SympifyError:
50
  st.error("Invalid function input. Please enter a valid mathematical expression.")
51
  return None, None