我知道这听起来很简单,但我正在为一个应该可以工作的高中课程编写一些代码。基本上,我正在解决一个非常受限的定义金字塔的方程组。问题是求解器说我的一个方程没有一个等式,尽管看起来它们都有。
我已经尝试了几乎所有的东西。我重新输入了方程式并仔细检查了所有语法。我已经有 2 天了同样的错误,我非常卡住
#sorry that the equations are messy but, they all have only one equality.
from gekko import GEKKO
V = 20
S = 30
t1 = 0.1
t2 = 0.2
t3 = 0.3
t4 = 0.05
t5 = 0.6
t6 = 0.2
t7 = 0.1
m = GEKKO()
x1= m.Var(value = 0)
x2= m.Var(value = 0)
x3= m.Var(value = 0)
y1= m.Var(value = 0)
y2= m.Var(value = 0)
y3= m.Var(value = 0)
z1= m.Var(value = 0)
z2= m.Var(value = 0)
z3= m.Var(value = 0)
t8= m.Var(value = 0)
t9= m.Var(value = 0)
t10= m.Var(value = 0)
t11= m.Var(value = 0)
t12= m.Var(value = 0)
m.Equations([
V == z3*(x1*y2 - x2*y1) + y3*(x2*z1 - x1*z3) + x3*(y1*z3 - y2*z1),\
S == 0.5 * m.sqrt(((x1*y2-x2*y1)**2)+((x2*z1-x1*z2)**2)+((x1*y2-x2*y1)**2)) + 0.5 * m.sqrt(((x1*y3-x3*y1)**2)+((x3*z1-x1*z3)**2)+((y1*z3-y3*z1)**2))+ 0.5 * m.sqrt(((x1*y3-x3*y1)**2)+((x3*z1-x1*z3)**2)+((y1*z3-y3*z1)**2)),\
t1 == [m.acos(x1*x2+y1*y2+z1*z2)/((m.sqrt((x1**2) +(y1**2) + (z1**2)))*(m.sqrt((x2**2) +(y2**2) + (z2**2))))],\
t2 == [m.acos(x1*x3+y1*y3+z1*z3)/((m.sqrt((x1**2) +(y1**2) + (z1**2)))*(m.sqrt((x3**2) +(y3**2) + (z3**2))))],\
t3 == [m.acos(x2*x3+y2*y3+z2*z3)/((m.sqrt((x2**2) +(y2**2) + (z2**2)))*(m.sqrt((x3**2) +(y3**2) + (z3**2))))],\
t4 == [m.acos((x1*(x1-x3)) +(y1*(y1-y3)) +(z1*(z1-z3))/((m.sqrt((x1**2) + (y1**2)+(z1**2))) * (m.sqrt((x1-x3)**2 + (y1-y3)**2 + (z1-z3)**2))))],\
t5 == [m.acos((x1*(x1-x2))+ (y1*(y1-y2))+(z1*(z1-z2))/((m.sqrt((x1**2) + (y1**2) + (z1**2)))*(m.sqrt((x1-x2)**2 + (y1-y2)**2 +(z1-z2)**2))))],\
t6 == [m.acos((x2*(x1-x2))+ (y2*(y1-y2))+(z2*(z1-z2))/((m.sqrt((x2**2) +(y2**2) + (z2**2)))*(m.sqrt((x1-x2)**2 +(y1-y2)**2 +(z1-z2)**2))))],\
t7 == [m.acos((x2*(x2-x3))+ (y2*(y2-y3))+(z2*(z2-z3))/((m.sqrt((x2**2) +(y2**2) + (z2**2)))*(m.sqrt((x2-x3)**2 +(y2-y3)**2 +(z2-z3)**2))))],\
t8 == [m.acos((x3*(x2-x3))+ (y3*(y2-y3))+(z3*(z2-z3))/((m.sqrt((x3**2) +(y3**2) + (z3**2)))*(m.sqrt((x2-x3)**2 +(y2-y3)**2 +(z2-z3)**2))))],\
t9 == [m.acos((x1*(x1-x3))+ (y1*(y1-y3))+(z1*(z1-z3))/((m.sqrt((x1**2) +(y1**2) + (z1**2)))*(m.sqrt((x1-x3)**2 +(y1-y3)**2 +(z1-z3)**2))))],\
t10 == [m.acos(((x1-x3) * (x2-x3) + (y1-y3) * (y2-y3) + (z1-z3) * (z2-z3)) /(m.sqrt((x1-x3)**2 + (y1-y3)**2 + (z1-z3)**2) * m.sqrt((x2-x3)**2 +(y2-y3)**2 + (z2-z3)**2)))],\
t11 == [m.acos(((x1-x3)* (x1-x2) + (y1-y3)*(y1-y2) +(z1-z3)*(z1-z2))/(m.sqrt((x1-x3)**2 + (y1-y3)**2 + (z1-z3)**2)* m.sqrt((x1-x2)**2 +(y1-y2)**2 +(z1-z2)**2)))],\
t12 == [m.acos(((x1-x2) *(x2-x3)+(y1-y2)*(y2-y3) +(z1-z2)*(z2-z3))/(m.sqrt((x1-x2)**2 +(y1-y2)**2 + (z1-z2)**2)* m.sqrt((x2-x3)**2 +(y2-y3)**2 +(z2-z3)**2)))] ])
m.solve(disp = True)
print("vector a:",x1.value,y1.value,z1.value, " vector b:",x2.value,y2.value,z2.value," vector c:",x3.value,y4.value,z3.value,)
错误是:异常:@error:方程式定义方程式没有等式(=)或不等式(>,<)false
但我不知道哪个方程不满足要求。