Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
| 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
|