Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定这些值:
x1 = {1, 3, 6, 8} x2 = {2 ,8, 5, 10} y = {8.6, 30.8, 34.1, 53.8}
而这个公式
y = m1 * x1 + m2 * x2
有没有办法使用 Math.NET 或等效的 C# 库来确定 m1 和 m2?
(这些值的预期结果是 m1=3.6 和 m2=2.5)
这只是一个线性方程组:在给定 X 和 y 的情况下求解 Xm = y。
var X = Matrix<double>.Build.DenseOfArray(new double[,] { { 1, 2 }, { 3, 8 }, { 6, 5 }, { 8, 10 } }); var y = Vector<double>.Build.Dense(new double[] { 8.6, 30.8, 34.1, 53.8 }); var m = X.Solve(y);