-
|
Hi, I am using MathNet.Numerics v4.7.0. I try to solve Ax = B (for x) when A is a 4 by 6 matrix with the following value array (note that the first row is all zeros - indices 0,7,13,19): And B is a 6-vector with the following values (note that first element is non-zero): And A.Solve(B) returns a solution which is obviously incorrect. What am I missing? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Note that the error is not necessarily zero. In your particular problem there exists no solution with zero error, since there is no solution for the equation |
Beta Was this translation helpful? Give feedback.
-
|
I understand now, thanks for your explanation. Is there any way to determine how "good" is the solution? Currently I'm looking at determining it from a business POV and then looking at |
Beta Was this translation helpful? Give feedback.
-
|
For a start, you could check whether the rank of the augmented matrix A|b is greater than the rank of A. If so, the system is inconsistent and there exists no solution - like in your example, where the former is 5 and the latter 4. |
Beta Was this translation helpful? Give feedback.
Solveis supposed to return the solution which minimizes the squared errors i.e.|Ax - b|. The returned vector looks ok to me. Is there another solution with a lower least-squares error?Note that the error is not necessarily zero. In your particular problem there exists no solution with zero error, since there is no solution for the equation
0 * t = -147339.22693314467corresponding to the first row of your 6x4 matrix and the first element of your 6-vector.