Spaces:
Sleeping
Sleeping
| # tools/math_tool.py | |
| import sympy as sp | |
| def try_sympy_solve(text: str): | |
| try: | |
| expr = sp.sympify(text) | |
| result = sp.solve(expr) | |
| if result == []: | |
| return None | |
| return result | |
| except Exception: | |
| return None | |