ai-math-mentor / tools /math_tool.py
ayush2917's picture
Update tools/math_tool.py
aa21caf verified
raw
history blame contribute delete
263 Bytes
# 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