[Referring to C1W2_Assignment Gaussian elimination]
Hi everyone,
I just finished the assignment. While it was certainly helpful for my programming skills and my understanding of the subject, I have some big critical points:
- The terms “reduced row echelon form” and “row echelon form” are not used correctly. The function titled reduced_row_echelon_form(A, B) does not return a reduced_row_echelon_form but only the row_echelon_form. The actual reduction happens in the back_substitution(M) function. This is majorly misleading for beginners to the topic
- The pivot definition at the beginning is super misleading: It says # Find the first non-zero entry in the current row (pivot).
This is the definition of the pivot element, yes. But it is not, what is needed to be assigned to pivot here.
To make it clear: pivot = M[i, get_index_first_non_zero_value_from_row(M, i)] by itself is a correct definition of the pivot element, but just not what is needed here (judging from how pivot variable is used in the rest of the code). I think the term pivot is not the right one to use here. More properly would be something like current_element or similar.
- Most importantly though does the test for reduced_row_echelon_form (which should have a different name to begin with as explained above) have a bug. F.e. for the matrices:
C = np.array([[1,2,3,4,5],[0,0,0,6,7], [0,0,8,9,10], [0,0,0,1,2], [0,0,0,0,3]])
D = np.array([[1], [2], [3], [4], [5]])
reduced_row_echelon_form(C, D) does not yield the correct result for my implementation even though I passed all tests.
Actually, it is not only a bug in the test but rather an error in the whole exercise, which I would assume 99%+ of implementations have, since the template clearly nudges one to do this and the explanation also explains it in a wrong way.
The problem is this part:
“2. Given the failure of step 1, search within the row for the first non-zero number, which becomes the new pivot.”
Without the additional step of reordering the rows at the end this is not correct and situations like the one with matrices C, D which I showed above can occur. Correctly, it should be something like “Given the failure of step 1, repeat the procedure for the same row, but increment the currently searched column by 1.”
I might be wrong about everything and will happily admit that if I am. Just wanted to let you know about this.