Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,9 +13,16 @@ def solve_equation(equation):
|
|
| 13 |
lhs_expr = sp.sympify(lhs)
|
| 14 |
rhs_expr = sp.sympify(rhs)
|
| 15 |
solution = sp.solve(lhs_expr - rhs_expr)
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
except Exception as e:
|
| 18 |
-
return pd.DataFrame([["Error", str(e)]], columns=["
|
| 19 |
|
| 20 |
# Function to simplify expressions
|
| 21 |
def simplify_expression(expression):
|
|
|
|
| 13 |
lhs_expr = sp.sympify(lhs)
|
| 14 |
rhs_expr = sp.sympify(rhs)
|
| 15 |
solution = sp.solve(lhs_expr - rhs_expr)
|
| 16 |
+
|
| 17 |
+
# Ensure the solution is in a format suitable for the table (convert to string)
|
| 18 |
+
if isinstance(solution, list): # If the solution is a list of values
|
| 19 |
+
solution = ', '.join(map(str, solution)) # Convert the list to a string
|
| 20 |
+
else:
|
| 21 |
+
solution = str(solution) # Convert any other solution (single value) to string
|
| 22 |
+
|
| 23 |
+
return pd.DataFrame([["Equation", equation], ["Solution", solution]], columns=["Description", "Result"])
|
| 24 |
except Exception as e:
|
| 25 |
+
return pd.DataFrame([["Error", str(e)]], columns=["Description", "Error"])
|
| 26 |
|
| 27 |
# Function to simplify expressions
|
| 28 |
def simplify_expression(expression):
|