I am learning Scilab for educational purposes.
When dealing with Gaussian Elimination we have that Ax=b. "A" is the matrix with the coefficients from the linear equations, "x" is the vector with the variables and "b" is the vector with the "solutions" from the linear system.
Let's suppose A is:
10. - 7. 0.
- 3. 2.09 6.
5. - 1. 5.
And b is:
7.
3.91
6.
Using the Gaussian elimination inside Scilab, we get the values of x as:
- 3.109D-14
- 1.
1.
Obs: - 3.109D-14 is a number close to zero.
When I do the matrix multiplication as A*x, I get a 3x1 vector with the same components as vector "b":
Finally, my doubt is: if A*x has the same values as "b", why the equality bellow returns False in Scilab?
It is probably due to the rounding error, and the inherent limitations of the floating point math, as indicated by Normal Human in his comment.
Another thing to remember: the Scilab console outputs rounded values, so internally there are usually more decimal places that are not shown, unless asked explicitly, e.g. mprintf("x= %.30f", x(1));
To circumvent this problem, you can try to clean
your array, that is, round the very small enties to 0. Try to see the result of:
A*clean(x)==b