Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,8 +44,8 @@ def calculate_derivative(func_str):
|
|
| 44 |
# Calculate the derivative
|
| 45 |
derivative = sp.diff(func, x)
|
| 46 |
# Convert sympy expressions to numerical functions
|
| 47 |
-
func_lambdified = sp.lambdify(
|
| 48 |
-
derivative_lambdified = sp.lambdify(
|
| 49 |
return func_lambdified, derivative_lambdified
|
| 50 |
except sp.SympifyError:
|
| 51 |
st.error("Invalid function input. Please enter a valid mathematical expression.")
|
|
|
|
| 44 |
# Calculate the derivative
|
| 45 |
derivative = sp.diff(func, x)
|
| 46 |
# Convert sympy expressions to numerical functions
|
| 47 |
+
func_lambdified = sp.lambdify(x_values, func, "numpy")
|
| 48 |
+
derivative_lambdified = sp.lambdify(x_values, derivative, "numpy")
|
| 49 |
return func_lambdified, derivative_lambdified
|
| 50 |
except sp.SympifyError:
|
| 51 |
st.error("Invalid function input. Please enter a valid mathematical expression.")
|