CIW2_Gaussian Elimination I am Lost

I can’t implement the Gaussian Elimination Assignment but I understand it well what can i do i need help

1 Like

Can you share the augmented matrix you are trying to transform?

The following code is how I would preform it on a randomly generated 4x4 matrix and 4x1 vector:

import numpy as np

Generate random matrix (4x4) and vector (4x1)

np.random.seed(0) # For reproducibility
A = np.random.randint(1, 10, (4, 4)).astype(np.float64)
b = np.random.randint(1, 10, 4).astype(np.float64)

{moderator edit - solution code removed}

2 Likes

In order to help, we need to know more than just “I have a problem”.

My interpretation of what you’re saying is that you have read the instructions carefully and believe that you understand the steps that the algorithm needs to implement. But you are having trouble translating that into working python code.

If that describes your situation, then the first question is how much python programming experience you have. This course assumes you already know python and have some non-trivial experience using it.

The next step in trying to help would be to start with some concrete problem. Where is the first place you run into trouble? Please show us the error output you are getting in that case. Please don’t show us the code: we aren’t supposed to share any solution code (even if it doesn’t work yet) in a public way. And that includes people trying to be helpful by just giving you a proposed solution.

1 Like

thanks, i have a good python programming experience but i can’t define the logic of it to implement it as python code
in the first exercise it has 2 test errors

1 Like

Share the image of those two test errors you are getting, probably then mentors can guide you where you are going wrong.

Regards
DP

1 Like

If you are a good programmer, then my suggestion is to debug this by adding print statements to your code. But first take the test case that fails (you can print the inputs or examine the test code by opening the test file) and write it out with pencil and paper. Then work out the steps by hand on paper. Now you know what you should be expecting from your algorithm. Then start with the print statements to show what is actually happening in the code. Now you’ve got something concrete to investigate: why is your code not correctly implementing the steps that you know should be happening. Where do things go “off the rails”?

1 Like

thanks a lot i am working on it