I am getting a grading issue as I got the Gaussian elimination correct but is not working at all.
{mentor edit: code removed}
I am getting a grading issue as I got the Gaussian elimination correct but is not working at all.
{mentor edit: code removed}
Please do not post your code on the forum. That’s not allowed by the Code of Conduct.
Your code doesn’t work correctly. That’s why the grader found errors.
Hey there! The error in gaussian_elimination
box indicates that you are trying to perform an operation that involves arrays or matrices with incompatible shapes. Double-check the dimensions and make sure they match up correctly!
The values shown for the back_substitution results are also incorrect.
How can I get the correct code to identify the main issue with the back_substitution as I am following the numbers that were given to me.
How should they look like then as for the dimensions I am just following the A and the B that were given to the worksheet and this needs to be updated with the current Python version 3.12 and not 3.7.
You’ll need to debug the problems with your code. One thing to check for is to make sure you are not “hard-coding” anything in your solutions, e.g. assuming what the dimensions of the inputs will be, as opposed to just using them. I’m not sure I’m reading it correctly, but the source code you posted looks like you are hard-coding the values of A and B. If so, that is a mistake: those are parameters passed into the function. You just use the values that are passed, right?
The numbers have given to me from the worksheet and so I can’t bill them out myself because this is what was this given to me
In addition to Paul’s reply:
Where the code has this comment:
You should use the helper function that was provided earlier in the notebook.
And, where you have hard-coded values for A and B. That’s not correct.
The back_substitution() function uses a matrix M. That’s all you need.
There are no A or B in this function.
Do you have experience programming in Python? If not, I recommend you attend a tutorial course immediately, then come back to this course later.
I had done Python training in the past as this course just needs to be updated in where it can handle the input.
No, the course is fine. You’re writing incorrect code.
Don’t define data inside a function. That’s fundamental to writing functions.
Functions should use the data that is passed to them in the parameter list.
All this function needs to use is the “M” matrix.
Okay then.