C1W2_Assignment Gaussian Elimination

When creating a post, please add:

Can you please help

Hey could you be more precise with your question

1 Like

The first suggestion is to put print statements everywhere so that you can see what is happening. At least print the row numbers and column numbers and the before and after values of the rows you are rewriting.

The other suggestion is more concrete about how to write the loops. Rather than doing it the way they suggest in the comments in the template code, I used “reversed(range(...))” on both of the loops and that made everything much simpler to write. Try this experiment to see how that works:

for ii in reversed(range(5)):
    print(f"ii = {ii}")

print(f"After loop ii = {ii}")

Running that gives this:

ii = 4
ii = 3
ii = 2
ii = 1
ii = 0
After loop ii = 0

That’s not part of the actual code, but just an example to demonstrate how “reversed(range)” works.

I did use print statements for debugging purpose but at last of this while back substitution I feel I am missing some part

{moderator edit - solution code removed}

please refer this link

The bug is that line. Why are you modifying substitution_row in the inner loop? That is managed by the outer loop, right? That causes you to skip the processing of some rows in the inner loop.

Thanks! for helping I guess I had messed up with indentation

Thanks!!