from sympy import symbols, Eq, solve
z = 1000000
x, y = symbols("x y")
equation_1 = Eq(2000000*x+50000000+1000000/0.8, z)
equation_2 = Eq(2000000*y+50000000+1000000/0.7, z)
while True:
# 解决方程组
solution = solve((equation_1, equation_2), (x, y))
x_val = solution[x]
y_val = solution[y]
# 计算方程式的值
equation_3_value = 2000000/(2000000+50000000/x_val+1000000/0.8*x_val)
equation_4_value = 2000000/(2000000+50000000/y_val+1000000/0.7*y_val)
if equation_3_value.evalf() < equation_4_value.evalf():
z += 100000
equation_1 = Eq(2000000*x+50000000+1000000/0.8, z)
equation_2 = Eq(2000000*y+50000000+1000000/0.7, z)
else:
break
print(z)
|