Do you update the x vector on the fly when using Jacobi Method to solve a matrix system of equations?

43 Views Asked by At

I am trying to work out an algorithm (on my own, without looking at Wikipedia, but thanks!) to solve $\textbf{Ax=b}$ using Jacobi Method. I decided to work through a small, generic 3x3 matrix to help me see how to form my code:

$$x^{k=1}_{1} = \frac{1}{a_{11}}(b_{1}-[a_{12}x^{k=0}_{2}+a_{13}x^{k=0}_{3}])$$

My question comes when I want to next solve for $x^{k=1}_{2}$. Do I use the new value of $x_{1}$ where $k=1$ (represented below) or do I use the original value from my first "guess" x vector (k=0)?

$$x^{k=1}_{2} = \frac{1}{a_{22}}(b_{2}-[a_{21}x^{k=1}_{1}+a_{23}x^{k=0}_{3}])$$

1

There are 1 best solutions below

2
On BEST ANSWER

In the Jacobi method you use value of all of the elements of $x$ from the previous iteration. In the Gauss-Seidel method you make use of the values that you've already updated in the current iteration. You're describing the Gauss-Seidel method in your question.