Gauss Seidel Method in CAn iterative procedure called the Gauss Seidel technique is used to resolve a square system of (many) linear equations. It is also frequently referred to as the "Liebmann" approach. Every effort at a solution in any iterative numerical analysis approach begins with a rough solution to an equation, and iterations are carried out until the necessary precision is attained. The most recent data are used in subsequent iterations of the Gauss-Seidel method. Round-off errors can be managed by the user using the Gauss-Seidel Method. The direct methods for the solution of simultaneous algebraic equations, such as Cramer's rule, matrix inversion method, Gauss Elimination method, etc., solve a predetermined amount of fixed computation. Therefore, the direct way of solution requires more time to complete. In contrast, using iterative approaches like the Gauss-Jacobi and Gauss-Seidel iteration methods, we begin with a rough solution to the problem and continue iterating until the necessary precision is achieved. The iterative manual computing process takes a while. However, high-level languages allow for quick and efficient program execution. This C program for the Gauss-Seidel method was created to solve linear simultaneous algebraic equations using the iteration principle. The Jacobi method and the Gauss-Seidel method are often referred to as the sequential displacement method. Given that the ensuing equations make use of newly acquired values. The following two requirements (must be met) are necessary for the Gauss-Seidel convergence criteria.
Steps involved:Step-1: For the variables in the system of linear equations, pick random initial values. The beginning points for the iteration process will be these values. Step-2: Use the existing values of the other variables, the provided system of linear equations, and each variable's new value to calculate the new value for each variable. This implies that you update each variable separately. Step-3: Calculate the absolute relative approximation error for each variable once Step 2 has updated all of the variables. How much the values have changed between iterations is indicated by the error. The approach is convergent to a solution and you can stop iterating if all variable errors fall below a certain tolerance (a tiny value you set). Code for the Gauss-Seidel algorithm:Output: Enter the Total Number of Equations: 2 Enter Allowed Error: 0.3 Enter the Coefficients Matrix[1][1] = 2 Matrix[1][2] = 6 Y[1] = 3.000000 Y[1] = 2.000000 Y[1] = 2.000000 Solution: Y[1]: 2.000000 Advantages:There are several advantages of the Gauss-Seidel method in C. Some advantages of the Gauss-Seidel method are as follows:
Disadvantages:There are several disadvantages of the Gauss-Seidel method in C. Some disadvantages of the Gauss-Seidel method are as follows:
Next TopicGetw() and Putw() function in C |