Coding the Gauss Elimination Algorithm in Python (ChEn 263 - Supplement to Lecture 11, Fixed!)

Поделиться
HTML-код
  • Опубликовано: 29 дек 2024

Комментарии • 13

  • @curiousperson7228
    @curiousperson7228 3 года назад +1

    Hello,
    Great code. How would you implement partial pivoting on this code. I am trying but stuck

    • @TreeSoftMatter
      @TreeSoftMatter  3 года назад +1

      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).

    • @chiefsteve6116
      @chiefsteve6116 2 года назад

      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

  • @subejba4148
    @subejba4148 2 года назад +1

    thank you very much sir

  • @ANINDYA-001
    @ANINDYA-001 3 года назад +3

    Thank you sir

  • @robertacarina
    @robertacarina 3 года назад

    the Python file used in the video isn't up to date!

    • @TreeSoftMatter
      @TreeSoftMatter  3 года назад +1

      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.

  • @chiefsteve6116
    @chiefsteve6116 2 года назад

    for gaus elimination your index in the 3'rd for loop has to be j in range(k, n), not (k,n-1)

  • @TripleJ-at
    @TripleJ-at Месяц назад

    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…

  • @TripleJ-at
    @TripleJ-at Месяц назад

    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.

    • @TreeSoftMatter
      @TreeSoftMatter  Месяц назад

      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.