Konstantin Metodiev

Preamble

This small article solely aims at providing source code listings for working out a solution to a diagonal dominant system of linear non-homogenous algebraic equations. As the title suggests, two iterative methods are considered, i.e. Jacobi's and modified Jacobi's (widely known as Gauss-Seidel). Numerous articles in the matter already exists which is why details such as proofs will not be discussed here. What motivates creating this article is simply sharing numerical implementations of these methods. Source codes in C are available for download in the left frame. I would be grateful if you found any flaws in the codes and let me know about them.

A problem to be solved

An exemplary system of linear non-homogenous equations borrowed from [1] follows.

J Formula

Criterion

The coefficient matrix is said to be strictly diagonally dominant if

J Formula

Jacobi method

Formula:

J Formula

Gauss-Seidel method

Formula:

GS Formula

Implementation

Source code:

Source

Results

The results obtained by means of proposed code have been compared with those published in [1] for validation purposes. The initial guess values are provided by calling "calloc" function in the beginning of each subroutine. A full agreement is observable.

Jacobi's method:

J Results

Gauss-Seidel's method:

GS Results

Conclusion

Believe it or not, Gauss-Seidel method is much faster than Jacobi's. In some cases however, the Gauss-Zeidel method may not converge even though the Jacobi's may.

In order to get the source built, I used tiny C compiler, [2].

References

[1] Fadugba Sunday Emmanuel, On Some Iterative Methods for Solving Systems of Linear Equations, Computational and Applied Mathematics Journal. Vol. 1, No. 2, 2015, pp. 21-28 AASCIT LINK

[2] https://bellard.org/tcc/ LINK


Post comment!