Exercise 2 - Back Substitution

Hello, I am stuck with the graded assessment lab’s exercise 2 (back substitution).
I have tried many things, including looking at the unittest file but I am still unsure of what I am doing wrong. I pass the first test case, but fail with the rest of them. Is there any way I could get some support? Thanks

Wrong output for test case check_matrix_1. 
	Expected:
	 [-0.33333333 -1.33333333  2.33333333].
	Got:
 [ 3.         -0.9         2.33333333].
Wrong output for test case check_matrix_2. 
	Expected:
	 [0.7857143  1.64285714 0.        ].
	Got:
 [ 8.         -0.35714286  0.        ].
Wrong output for test case check_matrix_3. 
	Expected:
	 [19. -2.  1.].
	Got:
 [  8. -10.   1.].
 1  Tests passed
 3  Tests failed
type or paste code here

Hi @emilio12

First of all, make sure you correctly initialize the variables before starting the back substitution process. Then, ensure you’re correctly iterating through the matrix from the last row to the first. Also, pay attention to the indexing and make sure they are correct and you don’t get indices out of matrix dim range.

Try debugging your code by printing the intermediate values to find out what causes the problem!

If these tips don’t resolve the issue, feel free to share your code in a private message, and I can help you debug it further!

1 Like

Thanks! I was able to solve the issue

1 Like