You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
333 B
17 lines
333 B
11 months ago
|
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("两个表达式不相等")
|