from sympy import symbols, Eq, simplify x = symbols('x') a = symbols('a') b = symbols('b') expr1 = a*x + b expr2 = 12*x + 1.3 eq = Eq(expr1, expr2) # 创建一个等式表达式 simplified_eq = simplify(eq) # 化简等式 if simplified_eq == True: print("两个表达式相等") else: print("两个表达式不相等")