✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
The Gauss-Seidel method updates variables sequentially, immediately using newly computed values:
A student implements Gauss-Seidel for a 3
3 system as follows:
def gauss_seidel(A, b, x, n_iter):
n = len(b)
for k in range(n_iter):
for i in range(n-1, -1, -1):
sigma = sum(A[i][j]*x[j] for j in range(n) if j != i)
x[i] = (b[i] - sigma) / A[i][i]
return x
The code updates variables in reverse order (
, then , then ) instead of forward order. How does this affect the method?