解一个含20个变量的非线性方程组

2024-04-24 13:14:03 发布

您现在位置:Python中文网/ 问答频道 /正文

variable names where modified in the code but it is the same equation

我已经给了20多个点,每个点包括a,b,c,u,v(绿色X,Y,Z,u,v)。 方程在代码中,并尝试用fsolve求解。你知道吗

我还能用什么解算器?因为fsolve、broyden等只对20个变量的20个方程进行运算。也很难猜测这些变量,所以我在哪里可以找到它们?你知道吗

def point_equations(x):
  k = (1 + x[9] * x[10]**2 + x[11] * x[10] ** 4 + x[12] * x[10] ** 6)

  for i in range(10):
     eq_x.append(k * (x[14] * ((x[15] * a[i] + x[16] * b[i] + x[17] * c[i] + x[18]) / (x[5] * a[i] + x[6] * b[i] + x[7] * c[i] + x[8]))) + x[19] - v[i])
     eq_y.append(k * (x[0] * ((x[1] * a[i] + x[2] * b[i] + x[3] * c[i] + x[4]) / (x[5] * a[i] + x[6] * b[i] + x[7] * c[i] + x[8]))) + x[13] - u[i])
  return eq_x + eq_y

predict = [10., 10., 10.0, 10., 10., 10.0, 10., 10., 10., 0., 10., 0., 0., 10., 10.0, 10., 10., 10., 10., 10.]

x = fsolve(point_equations, predict)

Tags: 代码infordefrangepredictpointeq