There are different algorithms for partial pivoting. One common way is to search the column (the j variable) for the element with the largest absolute value and do a swap. It is hard to write the whole algorithm in detail in a comment. Dorfman and Daoutidis have a nice explanation (with code) in Section 2.6 of "Numerical Methods with Chemical Engineering Applications" (www.amazon.com/Numerical-Chemical-Engineering-Applications-Cambridge/dp/1107135117).
Hi Roberta, the link to the Python file above is still good. I think you might mean that I didn't give the key, just the start. I did that so the students in my class would practice it for themselves! If you are learning to code GE for the first time, it is probably a good idea for you to do the same. That said, you can go to 12:24 to see the whole code. Also, you can check out: www.et.byu.edu/~treedoug/_pages/teaching/ChEn263/Lectures/Lec11.html for some more resources, including some more images of codes of forward elimination and back substitution.
As I said, you yourself are talking about the mistakes in the code. Therefore watching the video is a waste of time. It‘s not that I‘m unpolite, it‘s just saving other people‘s time. Why don‘t you correct it? This would be service…
I'm not sure what you are referring to. What part of the video is incorrect? Also, please make more polite comments. I have posted this video as a service for my students and others who wish to learn numerical methods. You are free to not watch if you don't find it useful. If there is an error, please let me know, and I would be happy to make note of it.
Hello,
Great code. How would you implement partial pivoting on this code. I am trying but stuck
There are different algorithms for partial pivoting. One common way is to search the column (the j variable) for the element with the largest absolute value and do a swap. It is hard to write the whole algorithm in detail in a comment. Dorfman and Daoutidis have a nice explanation (with code) in Section 2.6 of "Numerical Methods with Chemical Engineering Applications" (www.amazon.com/Numerical-Chemical-Engineering-Applications-Cambridge/dp/1107135117).
In the first for loop, looping over k, you just have to find the biggest element in the col k and swap this row with the current row k
thank you very much sir
You're welcome!
Thank you sir
You're welcome
the Python file used in the video isn't up to date!
Hi Roberta, the link to the Python file above is still good.
I think you might mean that I didn't give the key, just the start. I did that so the students in my class would practice it for themselves! If you are learning to code GE for the first time, it is probably a good idea for you to do the same.
That said, you can go to 12:24 to see the whole code. Also, you can check out: www.et.byu.edu/~treedoug/_pages/teaching/ChEn263/Lectures/Lec11.html for some more resources, including some more images of codes of forward elimination and back substitution.
for gaus elimination your index in the 3'rd for loop has to be j in range(k, n), not (k,n-1)
As I said, you yourself are talking about the mistakes in the code. Therefore watching the video is a waste of time. It‘s not that I‘m unpolite, it‘s just saving other people‘s time. Why don‘t you correct it? This would be service…
Why do you keep this video online if the code and therefore the result) is wrong? Please remove it. It's just a waste of time to watch it.
I'm not sure what you are referring to. What part of the video is incorrect? Also, please make more polite comments. I have posted this video as a service for my students and others who wish to learn numerical methods. You are free to not watch if you don't find it useful. If there is an error, please let me know, and I would be happy to make note of it.