from sympy import *
init_printing()
s, a1, a2, a3, a4, a5, a6, = symbols('s, a1, a2, a3, a4, a5, a6')
x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47 = symbols('x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47')
result=solve([(s+2*a1+a2+a5+2*a4+a3)*x1-1,
(s+2*a1+a2+(2/3)*a3+a4)*x2-(0.5*a1+0.25*a2)*x1,
(s+2*a1+a2+a5+(4/3)*a3+(2/3)*a4)*x3-(1.5*a1+0.75*a2)*x1,
(s+a1+a2+a5+1.5*a3+1.5*a4)*x4-(a5+2*a4)*x1,
(s+2*a1+a5+3*a3)*x5-a3*x1,
(s+2*a1+a2+2*a3)*x6-(a1+a2)*x2-((2/3)*a1+(1/3)*a2)*x3,
(s+a1+a2+1.5*a3+1.5*a4)*x7-a3*x2-0.25*(a1+a2)*x4,
(s+2*a1+3*a3)*x8-a4*x2-0.5*a1*x5,
(s+2*a1+a2+a5+(2/3)*a3+(1/3)*a4)*x9-((4/3)*a1+(2/3)*a2)*x3,
(s+a1+a2+a5+a3+a4)*x10-(a5+(4/3)*a3)*x3-0.75*(a1+a2)*x4,
(s+2*a1+a5+2*a3)*x11-(2/3)*a4*x3-1.5*a1*x5,
(s+a2+a6+3*a4)*x12-(a5+1.5*a3)*x4,
(s+a1+a5+3*a3)*x13-1.5*a4*x4-(a5+3*a3)*x5,
(s+2*a1+a2+(2/3)*a3+(1/3)*a4)*x14-(2*a1+a2)*x6-(a1+0.5*a2)*x9,
(s+2*a1+2*a2+a3+a4)*x15-(4/3)*a3*x6-(a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x32-0.5*a2*x33,
(s+a1+a5)*x42-a5*x32-0.5*a3*x34,
s*x43-(a6+a4)*x33-(a5+a3)*x34,
s*x44-a4*x37,-a4*x41,
s*x45-a4*x37-a1*x42,
s*x46-a1*x38-a1*x42,
s*x47-a5*x41-a5*x42],[x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41,x42,x43,x44,x45,x46,x47])
print(result)
sympy库解多元符号方程无法跑出结果
最新推荐文章于 2024-09-05 10:28:02 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)