Talk:Reduced row echelon form: Difference between revisions

Content added Content deleted
No edit summary
Line 187: Line 187:
0 0 0 0 0 0
0 0 0 0 0 0
</lang>
</lang>

== Still bug in java version? ==

I tried to run the the java code on matrix
<pre>
1, 2, 3, 4, 3, 1
2, 4, 6, 2, 6, 2
3, 6,18, 9, 9,-6
4, 8,12,10,12, 4
5,10,24,11,15,-4
</pre>
which correctly resulted in
<pre>
1, 2, 0, 0, 3, 4
0, 0, 1, 0, 0, -1
0, 0, 0, 1, 0, 0
0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0
</pre>
and then applied the code on this resulting matrix which generated an error. It seems that step 1 and step 2 do not recognize the correct pivot column for examples where there exist free variables in front of pivot columns (In the example above the second column of the resulting matrix). I corrected this by changing method isColumnZeroes not to consider the whole column:
<lang java>
public boolean isColumnZeroes(Coordinate coordinate) {
for (int i = coordinate.row; i < this.height; i++) { // <- not from i=0!!!!11
if (this.matrix[i][coordinate.col].getRatio() != 0.0) {
return false;
}
}
return true;
}
</lang>
Now it works. All the other examples are also solved correctly. I have to admit that I changed the code so I am not sure that this error also occurs in the original version.