如何求解具有n个方程的nC2个变量?

时间:2019-05-25 06:13:03

标签: python linear-algebra linear least-squares

我想使用numpy.linalg.lstsq求解python上存在nC2个变量和n个方程的值

import numpy as np
x = [[1,1,1,0,0,0],[1,0,0,1,1,0],[0,1,0,1,0,1],[0,0,1,0,1,1]]
y = [1,1,1,1]
x = np.array(x)
y = np.array(y)
A = np.vstack([x, np.ones(len(x))]).T
print(x)
m, c = np.linalg.lstsq(A, y)[0]
print(m,c)

0 个答案:

没有答案