File size: 263 Bytes
a17b6bc
 
 
 
 
aa21caf
a17b6bc
aa21caf
a17b6bc
aa21caf
 
 
 
 
a17b6bc
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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