Docsity

Gauss-Siedel Method - Numerical Methods - Lecture Slides, Slides of Mathematical Methods for Numerical Analysis and Optimization

Partial preview of the text

Download Gauss-Siedel Method - Numerical Methods - Lecture Slides and more Slides Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Gauss-Siedel Method

Gauss-Seidel Method

An iterative method.

Basic Procedure :

  • Algebraically solve each linear equation for x (^) i
  • Assume an initial guess solution array
  • Solve for each x (^) i and repeat
  • Use absolute relative approximate error after each iteration

to check if error is within a pre-specified tolerance.

Gauss-Seidel Method

Algorithm

A set of n equations and n unknowns:

a 11 (^) x 1 + a 12 x 2 + a 13 x 3 +... + a 1 n xn = b 1

a 21 (^) x 1 + a 22 x 2 + a 23 x 3 +... + a2n xn = b 2

an (^) 1 x 1 + an 2 x 2 + an 3 x 3 +...+ annxn = b n

.. .. ..

If: the diagonal elements are

non-zero

Rewrite each equation solving

for the corresponding unknown

ex:

First equation, solve for x 1

Second equation, solve for x 2

Gauss-Seidel Method

Algorithm

Rewriting each equation

11

1 12 2 13 3 1 1 a

c a x a x a x x

āˆ’ āˆ’ āˆ’ n n



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

āˆ’ āˆ’

āˆ’ āˆ’

āˆ’ āˆ’ āˆ’ āˆ’ āˆ’ āˆ’ āˆ’ āˆ’

āˆ’ āˆ’ āˆ’ āˆ’

āˆ’ āˆ’ āˆ’ āˆ’

āˆ’ āˆ’ āˆ’

 



ļ ļ ļ



From Equation 1

From equation 2

From equation n-

From equation n

Gauss-Seidel Method

Algorithm

General Form for any row ā€˜i’

, 1 , 2 , ,.

1

i n a

c a x

x

ii

n

j i

j

i ij j

i = 

āˆ’

=

āˆ‘

≠

=

How or where can this equation be used?

Gauss-Seidel Method

































n

n-

2

x

x

x

x

1

1

ļ

Solve for the unknowns

Assume an initial guess for [X] Use rewritten equations to solve for

each value of xi.

Important: Remember to use the

most recent value of xi. Which means to apply values calculated to

the calculations remaining in the

current iteration.

Gauss-Seidel Method: Example 1

Time, Velocity

5 106.

8 177.

12 279.

The upward velocity of a rocket

is given at three different times

The velocity data is approximated by a polynomial as:

( ) , 5 t 12. 2 3

2 1 v t = a t + a t + a ≤ ≤

t ( )s v ( m/s)

Table 1 Velocity vs. Time data.

Gauss-Seidel Method: Example 1

3

2

1

3

2 3

2

2 2

1

2 1

v

v

v

a

a

a

t t

t t

t t

3

2

1





















=









































  1. 2

  2. 2

  3. 8

144 12 1

64 8 1

25 5 1

3

2

1

a

a

a

Using a Matrix template of the form

The system of equations becomes

Initial Guess: Assume an initial guess of





















=





















5

2

1

3

2

1

a

a

a

Gauss-Seidel Method: Example 1

Applying the initial guess and solving for a i

3

2

1

a

a

a (^) 3. 6720

25

a 1 =

( ) ( )

  1. 8510 8

a 2 = āˆ’

( ) ( )

  1. 36 1

a 3 =āˆ’

Initial Guess

When solving for a 2 , how many of the initial guess values were used?

Gauss-Seidel Method: Example 1





















āˆ’

= āˆ’





















  1. 36

  2. 8510

  3. 6720

3

2

1

a

a

a

Ɨ 100

new i

old i

new i a (^) i x

x x

100 72. 76 %

  1. 6720

  2. 6720 1. 0000 a (^1) =

āˆ’ ∈ = x

100 125. 47 %

  1. 8510

  2. 8510 2. 0000 a (^2) = āˆ’

āˆ’ āˆ’ ∈ = x

100 103. 22 %

  1. 36

  2. 36 5. 0000 a (^3) = āˆ’

āˆ’ āˆ’ ∈ = x

Finding the absolute relative approximate error

At the end of the first iteration

The maximum absolute

relative approximate error is

125.47%

Gauss-Seidel Method: Example 1

Finding the absolute relative approximate error

100 69. 543 %

  1. 056

  2. 056 3. 6720 a (^1) =

āˆ’ ∈ = x

x 100 85. 695 %

  1. 882

  2. 882 7. 8510 2 = āˆ’

āˆ’ āˆ’ āˆ’ ∈ a =

( ) 100 80. 540 %

  1. 34

  2. 34 155. 36 a (^3) = āˆ’

āˆ’ āˆ’ āˆ’ ∈ = x

At the end of the second iteration





















āˆ’

= āˆ’





















  1. 54

  2. 882

  3. 056

3

2

1

a

a

a

The maximum absolute

relative approximate error is

85.695%

Iteration a 1 a 2 a 3

1 2 3 4 5 6

āˆ’7.

āˆ’54.

āˆ’255. āˆ’1093.

āˆ’4577.

āˆ’ 19049

āˆ’155.

āˆ’798.

āˆ’3448. āˆ’ 14440

āˆ’ 60072

āˆ’ 249580

Gauss-Seidel Method: Example 1









































  1. 0857

  2. 690

  3. 29048

a

a

a

3

2

1

Repeating more iterations, the following values are obtained

% a 1 ∈ (^) % a 2

a 3

Notice – The relative errors are not decreasing at any significant rate

Also, the solution is not converging to the true solution of

Gauss-Seidel Method: Pitfall

[ ] 



















123 16 1

45 43 1

2 5. 81 34 A





















=

96 34 129

23 53 5

124 34 56

[B]

Diagonally dominant : The coefficient on the diagonal must be at least

equal to the sum of the other coefficients in that row and at least one row

with a diagonal coefficient greater than the sum of the other coefficients

in that row.

Which coefficient matrix is diagonally dominant?

Most physical systems do result in simultaneous linear equations that

have diagonally dominant coefficient matrices.

Gauss-Seidel Method: Example 2

Given the system of equations

12 x 1 (^) + 3 x 2 - 5 x 3 = 1

x 1 (^) + 5 x 2 + 3 x 3 = 28

3 x 1 + 7 x 2 + 13 x 3 = 76





















=





















1

0

1

3

2

1

x

x

x

With an initial guess of

The coefficient matrix is:

[ ]



















 āˆ’

=

3 7 13

1 5 3

12 3 5

A

Will the solution converge using the

Gauss-Siedel method?