Description
The Jacobi method is an iterative method to solve systems of linear equations. The iterative methods have the advantage over elimination method of less round-off errors. It differs from the Gauss-Seidel method because it uses zeroes for the initial approximations.
a11x1a21x1⋮an1x1+++a12x2a22x2⋮an2x2+++⋯⋯⋯+++a1nxna2nxn⋮annxn====b1b2⋮bn Algorithm
If the diagonal elements are non-zero, each equation is rewritten for the corresponding unknown:
x1=a11b1−a12x2−a13x3−⋯−a1nxnx2=a22b2−a21x1−a23x3−⋯−a2nxn⋮xn=annbn−an1x1−an2x2−⋯−ann−1xn−1 Make all the variables equal to zero, x1=0, x2=0, …, xn=0.
Use the rewritten equations to calculate the new estimates.
Calculate the relative error for each xi, if it’s small enough, the iterations stop:
∣ep∣i=∣xinewxinew−xiold∣×100