Docsity

Gauss-Seidel Method - Numerical Analysis - Solved Exam, Exams of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
04.08.1
Chapter 04.08
Gauss-Seidel Method
After reading this chapter, you should be able to:
1. solve a set of equations using the Gauss-Seidel method,
2. recognize the advantages and pitfalls of the Gauss-Seidel method, and
3. determine under what conditions the Gauss-Seidel method always converges.
Why do we need another method to solve a set of simultaneous linear equations?
In certain cases, such as when a system of equations is large, iterative methods of solving
equations are more advantageous. Elimination methods, such as Gaussian elimination, are
prone to large round-off errors for a large set of equations. Iterative methods, such as the
Gauss-Seidel method, give the user control of the round-off error. Also, if the physics of the
problem are well known, initial guesses needed in iterative methods can be made more
judiciously leading to faster convergence.
What is the algorithm for the Gauss-Seidel method? Given a general set of n equations and
n unknowns, we have
11313212111 ... cxaxaxaxa nn
22323222121 ... cxaxaxaxa nn
. .
. .
. .
nnnnnnn cxaxaxaxa
...
332211
If the diagonal elements are non-zero, each equation is rewritten for the corresponding
unknown, that is, the first equation is rewritten with 1
x on the left hand side, the second
equation is rewritten with 2
x on the left hand side and so on as follows
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Gauss-Seidel Method - Numerical Analysis - Solved Exam and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Chapter 04.

Gauss-Seidel Method

After reading this chapter, you should be able to:

  1. solve a set of equations using the Gauss-Seidel method,
  2. recognize the advantages and pitfalls of the Gauss-Seidel method, and
  3. determine under what conditions the Gauss-Seidel method always converges.

Why do we need another method to solve a set of simultaneous linear equations?

In certain cases, such as when a system of equations is large, iterative methods of solving equations are more advantageous. Elimination methods, such as Gaussian elimination, are prone to large round-off errors for a large set of equations. Iterative methods, such as the Gauss-Seidel method, give the user control of the round-off error. Also, if the physics of the problem are well known, initial guesses needed in iterative methods can be made more judiciously leading to faster convergence. What is the algorithm for the Gauss-Seidel method? Given a general set of n equations and n unknowns, we have a 11 (^) x 1  a 12 x 2  a 13 x 3 ...  a 1 n xnc 1 a 21 (^) x 1  a 22 x 2  a 23 x 3 ...  a 2 n xnc 2

.. .. .. an (^) 1 x 1  an 2 x 2  an 3 x 3 ... annxnc n

If the diagonal elements are non-zero, each equation is rewritten for the corresponding unknown, that is, the first equation is rewritten with x 1 on the left hand side, the second

equation is rewritten with x 2 on the left hand side and so on as follows

04.08.2 Chapter 04.

nn

n n n nn n n

n n

n n n n n n n n n n

n n

a

c a x a x a x x

a

c a x a x a x a x x

a

c a x a x a x x

1 1 2 2 , 1 1

1 , 1

1 1 , 1 1 1 , 2 2 1 , 2 2 1 , 1

22

2 21 1 23 3 2 2

 

 

       

    

These equations can be rewritten in a summation form as

11

1 1

1 1

(^1) a

c a x

x

n

j j

 j j

 

22

2 1

2 2

(^2) a

c a x

x

j

n

j j

 j

 

1 , 1

1 1

1 1 ,

1  

 

 

n n

n

jn j

n n j j

n a

c a x

x

nn

n

jn j

n nj j

n a

c a x

x

 

1

Hence for any row i ,

1 i n a

c a x

x ii

n

ji j

i ij j

i  

 

Now to find xi ’s, one assumes an initial guess for the xi ’s and then uses the rewritten

equations to calculate the new estimates. Remember, one always uses the most recent estimates to calculate the next estimates, xi. At the end of each iteration, one calculates the

absolute relative approximate error for each xi as

new^100

new old 

i

i i ai x

x x

where x i newis the recently obtained value of xi , and x i oldis the previous value of xi.

04.08.4 Chapter 04.

144 a 1  12 a 2  a 3  279. 2

The coefficients a 1 (^) , a 2 ,and a 3 for the above expression are given by

3

2

1

a

a

a

Rewriting the equations gives

1

a a a

2

a a a

3

a a a

Iteration # Given the initial guess of the solution vector as

3

2

1

a

a

a

we get

1

a

 3. 6720

2

a

 7. 8150

3

a

 155. 36 The absolute relative approximate error for each xi then is

100

  1. 6720

a

 72. 76 %

100

  1. 8510

a

 125. 47 %

100

  1. 36

a

 103. 22 % At the end of the first iteration, the estimate of the solution vector is

Gauss-Seidel Method 04.08.

3

2

1

a

a

a

and the maximum absolute relative approximate error is 125.47%.

Iteration # The estimate of the solution vector at the end of Iteration #1 is

3

2

1

a

a

a

Now we get

1

a

 12. 056

2

a

 54. 882

3

a

=  798. 34 The absolute relative approximate error for each xi then is

100

  1. 056

a

 69. 543 %

a

 85. 695 %

a

 80. 540 % At the end of the second iteration the estimate of the solution vector is

3

2

1

a

a

a

and the maximum absolute relative approximate error is 85.695%. Conducting more iterations gives the following values for the solution vector and the corresponding absolute relative approximate errors.

Gauss-Seidel Method 04.08.

A

is diagonally dominant as

a 11  12  12  a 12  a 13  3  5  8 a 22  5  5  a 21  a 23  1  3  4 a 33  13  13  a 31  a 32  3  7  10

and the inequality is strictly greater than for at least one row. Hence, the solution should converge using the Gauss-Seidel method. Rewriting the equations, we get

1

x x x

2

x x x

3

x x x

Assuming an initial guess of

3

2

1

x

x

x

Iteration #

1

x

 0. 50000

2

x

 4. 9000

3

x

 3. 0923 The absolute relative approximate error at the end of the first iteration is

100

  1. 50000

a

 100. 00 %

100

  1. 9000

a

 100. 00 %

100

  1. 0923

a

 67. 662 %

04.08.8 Chapter 04.

The maximum absolute relative approximate error is 100.00%

Iteration #

1

x

 0. 14679

2

x

 3. 7153

3

x

 3. 8118 At the end of second iteration, the absolute relative approximate error is

100

  1. 14679

a

 240. 61 %

100

  1. 7153

a

 31. 889 %

100

  1. 8118

a

 18. 874 % The maximum absolute relative approximate error is 240.61%. This is greater than the value of 100.00% we obtained in the first iteration. Is the solution diverging? No, as you conduct more iterations, the solution converges as follows.

Iteration x 1^  a^1 % x 2^  a^2 % x 3^  a 3 % 1 2 3 4 5 6

This is close to the exact solution vector of

3

2

1

x

x

x

Example 3

Given the system of equations 3 x 1 (^)  7 x 2  13 x 3  76

04.08.10 Chapter 04.

Therefore, it is possible that a system of equations can be made diagonally dominant if one exchanges the equations with each other. However, it is not possible for all cases. For example, the following set of equations x 1  x 2  x 3  3 2 x 1  3 x 2  4 x 3  9 x 1  7 x 2  x 3  9

cannot be rewritten to make the coefficient matrix diagonally dominant.

Key Terms:

Gauss-Seidel method Convergence of Gauss-Seidel method Diagonally dominant matrix