已知:
10a+6b+5c+2e=229
6a+2b+6c+6e=264
13a+11b+9c+2e=361
11a+9b+7c+4d+2e=339
8a+8b+5c+2d+e=244
求解
a b c d e
from sympy.solvers import solve
from sympy import Symbol
a = Symbol("a")
b = Symbol("b")
c = Symbol("c")
d = Symbol("d")
e = Symbol("e")
expr = [
10*a+6*b+5*c+2*e-229,
6*a+2*b+6*c+6*e-264,
13*a+11*b+9*c+2*e-361,
11*a+9*b+7*c+4*d+2*e-339,
8*a+8*b+5*c+2*d+e-244
]
args = [
a,b,c,d,e
]
res = solve(expr, args)
#求出的结果
print(res)
# 测试结果是否正确
a = res.get(a)
b = res.get(b)
c = res.get(c)
d = res.get(d)
e = res.get(e)
print(10 * a + 6 * b + 5 * c + 2 * e)
print(6 * a + 2 * b + 6 * c + 6 * e)
print(13 * a + 11 * b + 9 * c + 2 * e)
print(11*a+9*b+7*c+4*d+2*e)
print(8 * a + 8 * b + 5 * c + 2 * d + e)