linear systems – iterative methods 1.jacobi method 2.gauss-siedel method 1

65
Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Upload: agnes-cooper

Post on 17-Jan-2016

262 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Linear Systems – Iterative methods

1. Jacobi Method2. Gauss-Siedel Method

1

Page 2: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iterative Methods

Iterative methods can be expressed in the general form: x(k) =F(x(k-1))

where s s.t. F(s)=s is called a Fixed Point

Hopefully: x(k) s (solution of my problem)

Will it converge? How rapidly?2

Page 3: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iterative MethodsStationary: x(k+1) =Gx(k)+cwhere G and c do not depend on

iteration count (k)

Non Stationary:x(k+1) =x(k)+akp(k)

where computation involves information that change at each iteration

3

Page 4: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iterative – StationaryJacobi

In the i-th equation solve for the value of xi while assuming the other entries of x remain fixed:

In matrix terms the method becomes:

where D, -L and -U represent the diagonal, the strictly lower-trg and strictly upper-trg parts of M

ii

ijjiji

i

N

jijij m

xmb

xbxm

1 ii

ij

kjiji

ki m

xmb

x

)1(

)(

bDxULDx kk 111)(

4

Page 5: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iterative – StationaryGauss-Seidel

Like Jacobi, but now assume that previously computed results are used as soon as they are available:

In matrix terms the method becomes:

where D, -L and -U represent the diagonal, the strictly lower-trg and strictly upper-trg parts of M

ii

ijjiji

i

N

jijij m

xmb

xbxm

1 ii

ij

kjij

ij

kjiji

ki m

xmxmb

x

)1()(

)(

)( 11)( bUxLDx kk

5

Page 6: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iterative – Stationary Successive Overrelaxation

(SOR)Devised by extrapolation applied to Gauss-Seidel in the

form of weighted average:

In matrix terms the method becomes:

where D, -L and -U represent the diagonal, the strictly lower-trg and strictly upper-trg parts of M

w is chosen to increase convergence

ii

ij

kjij

ij

kjiji

ki m

xmxmb

x

)1()(

)(

bwLDwxDwwUwLDx kk 111)( )())1((

)1()()( )1( ki

ki

ki xwxwx

6

Page 7: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

7

Jacobi iteration

nnnnnn

nn

nn

bxaxaxa

bxaxaxa

bxaxaxa

2211

22222121

11212111

0

02

01

0

nx

x

x

x

)(1 0

102121

11

11 nn xaxab

ax

1

1 1

1 1 i

j

n

ij

kjij

kjiji

ii

ki xaxab

ax

)(1 0

11022

011

1 nnnnnn

nnn xaxaxab

ax

)(1 0

20323

01212

22

12 nn xaxaxab

ax

Page 8: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

8

Gauss-Seidel (GS) iteration

nnnnnn

nn

nn

bxaxaxa

bxaxaxa

bxaxaxa

2211

22222121

11212111

0

02

01

0

nx

x

x

x

1

1 1

11 1 i

j

n

ij

kjij

kjiji

ii

ki xaxab

ax)(

1 01

02121

11

11 nn xaxab

ax

)(1 1

11122

111

1 nnnnnn

nnn xaxaxab

ax

)(1 0

20323

11212

22

12 nn xaxaxab

ax

Use the latestupdate

Page 9: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodAn iterative method.

Basic Procedure:

-Algebraically solve each linear equation for xi

-Assume an initial guess solution array

-Solve for each xi and repeat

-Use absolute relative approximate error after each iteration to check if error is within a pre-specified tolerance.

9

Page 10: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodWhy?

The Gauss-Seidel Method allows the user to control round-off error.

Elimination methods such as Gaussian Elimination and LU Decomposition are prone to prone to round-off error.

Also: If the physics of the problem are understood, a close initial guess can be made, decreasing the number of iterations needed.

10

Page 11: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodAlgorithm

A set of n equations and n unknowns:

11313212111 ... bxaxaxaxa nn

2323222121 ... bxaxaxaxa n2n

nnnnnnn bxaxaxaxa ...332211

. . . . . .

If: the diagonal elements are non-zero

Rewrite each equation solving for the corresponding unknown

ex:

First equation, solve for x1

Second equation, solve for x2

11

Page 12: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodAlgorithm

Rewriting each equation

11

131321211 a

xaxaxacx nn

nn

nnnnnnn

nn

nnnnnnnnnn

nn

a

xaxaxacx

a

xaxaxaxacx

a

xaxaxacx

11,2211

1,1

,122,122,111,111

22

232312122

From Equation 1

From equation 2

From equation n-1

From equation n

12

Page 13: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodAlgorithm

General Form of each equation

11

11

11

1 a

xac

x

n

jj

jj

22

21

22

2 a

xac

x

j

n

jj

j

1,1

11

,11

1

nn

n

njj

jjnn

n a

xac

x

nn

n

njj

jnjn

n a

xac

x

1

13

Page 14: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodAlgorithm

General Form for any row ‘i’

.,,2,1,1

nia

xac

xii

n

ijj

jiji

i

How or where can this equation be used?

14

Page 15: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodSolve for the unknowns

Assume an initial guess for [X]

n

-n

2

x

x

x

x

1

1

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.

15

Page 16: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodCalculate the Absolute Relative Approximate Error

100

newi

oldi

newi

ia x

xx

So when has the answer been found?

The iterations are stopped when the absolute relative approximate error is less than a prespecified tolerance for all unknowns.

16

Page 17: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

17

Suppose that for conciseness we limit ourselves to a 33 set of equations.

(11.1c)

(11.1b)

(11.1a)

33

23213133

22

13231212

2

11

1313

12121

1

a

xaxabx

a

xaxabx

a

xaxabx

jjj

jjj

jjj

where j and j -1 are the present and previous iterations.

To start the solution process, initial guesses must be made for the x’s. A simple approach is to assume that they are all zero.

Page 18: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

18

sji

ji

ji

ia x

xx

%1001

,

Convergence can be checked using the criterion

that for i,

Page 19: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

19

Graphical depiction of the difference between (a) the Gauss-Seidel and (b) the Jacobi iterative methods for solving simultaneous linear algebraic equations.

Page 20: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Jacobi Iterative Technique

Consider the following set of equations.

15

11

25

6

83

102

311

210

432

4321

4321

321

xxx

xxxx

xxxx

xxx

20

Page 21: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Convert the set Ax = b in the form of x = Tx + c.

8

15

8

1

8

3

10

11

10

1

10

1

5

1

11

25

11

3

11

1

11

1

5

3

5

1

10

1

324

4213

4312

321

xxx

xxxx

xxxx

xxx

21

Page 22: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

8

15

8

1

8

3

10

11

10

1

10

1

5

1

11

25

11

3

11

1

11

1

5

3

5

1

10

1

03

02

14

04

02

01

13

04

03

01

12

03

02

11

)()()(

)()()()(

)()()()(

)()(

xxx

xxxx

xxxx

xxx )(

Start with an initial approximation of:

.and,, )()()()( 0000 04

03

02

01 xxxx

22

Page 23: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

8

15

8

1

8

3

10

11

10

1

10

1

5

1

11

25

11

3

11

1

11

1

5

3

5

1

10

1

14

13

12

11

(0)(0)

(0)(0)(0)

(0)(0)(0)

(0)(0)

)(

)(

)(

x

x

x

x )(

8750110001

27272600001

41

3

12

11

.and.

,.,.)()(

)()(

xx

xx

23

Page 24: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

8

15

8

1

8

3

10

11

10

1

10

1

5

1

11

25

11

3

11

1

11

1

5

3

5

1

10

1

13

12

24

14

12

11

23

14

13

11

22

13

12

21

)()()(

)()()()(

)()()()(

)()(

xxx

xxxx

xxxx

xxx )(

24

Page 25: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

8

15

8

1

8

3

10

11

10

1

10

1

5

1

11

25

11

3

11

1

11

1

5

3

5

1

10

1

13

124

14

12

113

14

13

112

13

121

)()()(

)()()()(

)()()()(

)()(

kkk

kkkk

kkkk

kk(k)

xxx

xxxx

xxxx

xxx

25

Page 26: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

k 0 1 2 3

0.0000 0.6000 1.0473 0.9326

0.0000 2.2727 1.7159 2.0530

0.0000 -1.1000 -0.8052 -1.0493

0.0000 1.8750 0.8852 1.1309

)( kx1

)( kx2

)( kx3

)( kx4

Results of Jacobi Iteration:

26

Page 27: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Iterative Technique

Consider the following set of equations.

15

11

25

6

83

102

311

210

432

4321

4321

321

xxx

xxxx

xxxx

xxx

27

Page 28: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

8

15

8

1

8

3

10

11

10

1

10

1

5

1

11

25

11

3

11

1

11

1

5

3

5

1

10

1

13

124

14

12

113

14

13

112

13

121

)()()(

)()()()(

)()()()(

)()(

kkk

kkkk

kkkk

kk(k)

xxx

xxxx

xxxx

xxx

28

Page 29: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

8

15

8

1

8

3

10

11

10

1

10

1

5

1

11

25

11

3

11

1

11

1

5

3

5

1

10

1

324

14213

14

1312

13

121

)()()(

)()()()(

)()()()(

)()(

kkk

kkkk

kkkk

kk(k)

xxx

xxxx

xxxx

xxx

29

Page 30: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

k 0 1 2 3

0.0000 0.6000

0.6000

1.0300

1.0473

1.0065

0.9326

0.0000 2.3272

2.2727

2.0370

1.7159

2.0036

2.0530

0.0000 -0.9873

-1.1000

-1.0140

-0.8052

-1.0025

-1.0493

0.0000 0.8789

1.8750

0.9844

0.8852

0.9983

1.1309

)( kx1

)( kx2

)( kx3

)( kx4

Results of Gauss-Seidel Iteration:(Blue numbers are for Jacobi iterations.)

30

Page 31: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

It required 15 iterations for Jacobi method and 7 iterations for Gauss-

Seidel method to arrive at the solution with a tolerance of 0.00001.

While Jacobi would usually be the slowest of the iterative methods, it is well suited to

illustrate an algorithm that is well suited for parallel

processing!!!

The solution is: x1= 1, x2 = 2, x3 = -1, x4 = 1

31

Page 32: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

32

EXAMPLE Gauss-Seidel Method

Problem Statement. Use the Gauss-Seidel method to obtain the solution for

4.71 102.03.0

3.193.071.0

85.7 2.01.03

321

321

321

xxx

xxx

xxx

Note that the solution is 75.23 Tx

Solution. First, solve each of the equations for its unknown on the diagonal:

Page 33: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

33

(E11.1.3) 10

2.03.04.71

(E11.1.2) 7

3.01.03.19

(E11.1.1) 3

2.01.085.7

213

312

321

xxx

xxx

xxx

By assuming that x2 and x3 are zero

616667.2

3

02.001.085.71

x

This value, along with the assumed value of x3 =0, can be substituted into Eq.(E11.1.2) to

calculate 794524.2

7

03.0616667.21.03.192

x

Page 34: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

34

The first iteration is completed by substituting the calculated values for x1 and x2 into Eq.(E11.1.3) to

yield 005610.7

10

794524.22.0616667.23.04.713

x

For the second iteration, the same process is repeated to compute

000291.7

10

499625.22.0990557.23.04.71

499625.27

005610.73.0990557.21.03.19

990557.23

005610.72.0794524.21.085.7

3

2

1

x

x

x

Page 35: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

35

The method is, therefore, converging on the true solution. Additional iterations could be applied to

improve the answers. Consequently, we can estimate the error. For example , for x1

%5.12%100990557.2

616667.2990557.21,

a

For x2 and x3 , the error estimates are

%076.0

%8.11

3,

2,

a

a

Repeat to it again until the result is known to at least the tolerance specified by s.

Page 36: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

Three-phase loads are common in AC systems. When the system is balanced the analysis can be simplified to a single equivalent circuit model. However, when it is unbalanced the only practical solution involves the solution of simultaneous

linear equations. In a model the following equations need to be solved.

9.103

00.60

9.103

00.60

000.0

120

8080.06040.00100.00080.00100.00080.0

6040.08080.00080.00100.00080.00100.0

0100.00080.07787.05205.00100.00080.0

0080.00100.05205.07787.00080.00100.0

0100.00080.00100.00080.07460.04516.0

0080.00100.00080.00100.04516.07460.0

ci

cr

bi

br

ai

ar

I

I

I

I

I

I

Find the values of Iar , Iai , Ibr , Ibi , Icr , and Ici using the Gauss-Seidel method.

36

Page 37: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

Rewrite each equation to solve for each of the unknowns

74600

008000100000800010004516000120

.

I.I.I.I.I..I cicrbibrai

ar

74600

01000008000100000800451600000

.

I.I.I.I.I..I cicrbibrar

ai

77870

00800010005205000800010000060

.

I.I.I.I.I..I cicrbiaiar

br

77870

01000008005205001000008009103

.

I.I.I.I.I..I cicrbraiar

bi

80800

60400008000100000800010000060

.

I.I.I.I.I..I cibibraiar

cr

80800

60400010000080001000008009103

.

I.I.I.I.I..I crbibraiar

ci

37

Page 38: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

Initial Guess:

For iteration 1, start with an initial guess value

20

20

20

20

20

20

ci

cr

bi

br

ai

ar

I

I

I

I

I

I

38

Page 39: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

86.17274600

0080001000008000100045160120

.

I.I.I.I.I.I cicrbibrai

ar

61.10574600

0100000800010000080045160000

.

I.I.I.I.I..I cicrbibrar

ai

Substituting the guess values into the first equation

Substituting the new value of Iar and the remaining guess values into the second equation

39

Page 40: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

039.6777870

00800010005205000800010000060

.

I.I.I.I.I..I cicrbiaiar

br

499.8977870

01000008005205001000008009103

.

I.I.I.I.I..I cicrbraiar

bi

Substituting the new values Iar , Iai , and the remaining guess values into the third equation

Substituting the new values Iar , Iai , Ibr , and the remaining guess values into the fourth equation

40

Page 41: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

548.6280800

60400008000100000800010000060

.

I.I.I.I.I..I cibibraiar

cr

71.17680800

60400010000080001000008009103

.

I.I.I.I.I..I crbibraiar

ci

Substituting the new values Iar , Iai , Ibr , Ibi , and the remaining guess values into the fifth equation

Substituting the new values Iar , Iai , Ibr , Ibi , Icr , and the remaining guess value into the sixth equation

41

Page 42: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

How accurate is the solution? Find the absolute relative approximate error using:

100

newi

oldi

newi

ia x

xx

At the end of the first iteration, the solution matrix is:

71.176

548.62

499.89

039.67

61.105

86.172

I

I

I

I

I

I

ci

cr

bi

br

ai

ar

42

Page 43: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

%430.8810086.172

2086.1721

a

%.

.a 94.118100

61105

20611052

%83.129100039.67

20039.673

a

%35.122100499.89

20499.894

a

%98.131100548.62

20548.625

a

%682.8810071.176

2071.1766

a

Calculating the absolute relative approximate errors

The maximum error after the first iteration is:

131.98%

Another iteration is needed!

43

Page 44: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

Starting with the values obtained in iteration #1

71176

54862

49989

03967

61105

86172

.

.

.

.

.

.

I

I

I

I

I

I

ci

cr

bi

br

ai

ar

600.9974600

008000100000800010004516000120

.

I.I.I.I.I..I cicrbibrai

ar

Substituting the values from Iteration 1 into the first equation

44

Page 45: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

073.6074600

0100000800010000080045160000

.

I.I.I.I.I..I cicrbibrar

ai

15.13677870

00800010005205000800010000060

.

I.I.I.I.I..I cicrbiaiar

br

Substituting the new value of Iar and the remaining values from Iteration 1 into the second equation

Substituting the new values Iar , Iai , and the remaining values from Iteration 1 into the third equation

45

Page 46: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

299.4477870

01000008005205001000008009103

.

I.I.I.I.I..I cicrbraiar

bi

Substituting the new values Iar , Iai , Ibr , and the remaining values fromIteration 1 into the fourth equation

259.5780800

60400008000100000800010000060

.

I.I.I.I.I..I cibibraiar

cr

Substituting the new values Iar , Iai , Ibr , Ibi , and the remaining values From Iteration 1 into the fifth equation

46

Page 47: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

441.8780800

60400010000080001000008009103

.

I.I.I.I.I..I crbibraiar

ci

Substituting the new values Iar , Iai , Ibr , Ibi , Icr , and the remaining value from Iteration 1 into the sixth equation

The solution matrix at the end of the second iteration is:

44187

25957

29944

15136

07360

60099

.

.

.

.

.

.

I

I

I

I

I

I

ci

cr

bi

br

ai

ar

47

Page 48: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

Calculating the absolute relative approximate errors for the second iteration

The maximum error after the second iteration is:

209.24%

More iterations are needed!

%552.73100600.99

86.172600.991

a

%796.75100073.60

)61.105(073.602

a

%762.5010035.136

)039.67(35.1363

a

%03.102100299.44

)499.89(299.444

a

%24.209100259.57

)548.62(259.575

a

%09.102100441.87

71.176441.876

a

48

Page 49: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

Repeating more iterations, the following values are obtained

Iteration Iar Iai Ibr Ibi Icr Ici

123456

172.8699.600126.01117.25119.87119.28

−105.61−60.073−76.015−70.707−72.301−71.936

−67.039−136.15−108.90−119.62−115.62−116.98

−89.499−44.299−62.667−55.432−58.141−57.216

−62.54857.259

−10.47827.6586.251318.241

176.7187.441137.97109.45125.49116.53

%1a %

2a %3a %

4a %5a %

6aIteration

123456

88.43073.55220.9607.47382.1840

0.49408

118.9475.79620.9727.50672.2048

0.50789

129.8350.76225.0278.96313.46331.1629

122.35102.0329.31113.0534.65951.6170

131.98209.24646.45137.89342.4365.729

88.682102.0936.62326.00112.7427.6884

49

Page 50: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

The absolute relative approximate error is still high, but allowing for more iterations, the error quickly begins to

converge to zero.

What could have been done differently to allow for a faster convergence?

After six iterations, the

solution matrix is

53.116

241.18

216.57

98.116

936.71

28.119

ci

cr

bi

br

ai

ar

I

I

I

I

I

I

The maximum error after the sixth iteration is:

65.729%

50

Page 51: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iteration

32

33

3.0666×10−7

1.7062×10−7

3.0047×10−7

1.6718×10−7

4.2389×10−7

2.3601×10−7

5.7116×10−7

3.1801×10−7

2.0941×10−5

1.1647×10−5

1.8238×10−6

1.0144×10−6

Example: Unbalanced three phase load

Iteration Iar Iai Ibr Ibi Icr Ici

3233

119.33119.33

−71.973−71.973

−116.66−116.66

−57.432−57.432

13.94013.940

119.74119.74

Repeating more iterations, the following values are obtained

%1a %

2a %3a %

4a %5a %

6a

51

Page 52: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Example: Unbalanced three phase load

After 33 iterations, the solution matrix is

74119

94013

432.57

66.116

973.71

33.119

.

.

I

I

I

I

I

I

ci

cr

bi

br

ai

ar

The maximum absolute relative approximate error is 1.1647×10−5%.

52

Page 53: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Pitfall

Even though done correctly, the answer may not converge to the correct answer.

This is a pitfall of the Gauss-Siedel method: not all systems of equations will converge.

Is there a fix?

One class of system of equations always converges: One with a diagonally dominant coefficient matrix.

Diagonally dominant: [A] in [A] [X] = [C] is diagonally dominant if:

n

jj

ijaa

i1

ii

n

ijj

ijii aa1

for all ‘i’ and for at least one ‘i’

53

Page 54: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Pitfall

116123

14345

3481.52

A

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.

1293496

55323

5634124

]B[

Which coefficient matrix is diagonally dominant?

Most physical systems do result in simultaneous linear equations that have diagonally dominant coefficient matrices.

54

Page 55: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Example 2

Given the system of equations

15312 321 x- x x

2835 321 x x x 761373 321 x x x

1

0

1

3

2

1

x

x

x

With an initial guess of

The coefficient matrix is:

1373

351

5312

A

Will the solution converge using the Gauss-Siedel method?

55

Page 56: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Example 2

1373

351

5312

A

Checking if the coefficient matrix is diagonally dominant

43155 232122 aaa

10731313 323133 aaa

8531212 131211 aaa

The inequalities are all true and at least one row is strictly greater than:

Therefore: The solution should converge using the Gauss-Siedel Method

56

Page 57: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Example 2

76

28

1

1373

351

5312

3

2

1

a

a

a

Rewriting each equation

12

531 321

xxx

5

328 312

xxx

13

7376 213

xxx

With an initial guess of

1

0

1

3

2

1

x

x

x

50000.0

12

150311

x

9000.4

5

135.0282

x

0923.3

13

9000.4750000.03763

x

57

Page 58: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Example 2

The absolute relative approximate error

%00.10010050000.0

0000.150000.01

a

%00.1001009000.4

09000.42a

%662.671000923.3

0000.10923.33a

The maximum absolute relative error after the first iteration is 100%

58

Page 59: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Example 2

8118.3

7153.3

14679.0

3

2

1

x

x

x

After Iteration #1

14679.0

12

0923.359000.4311

x

7153.3

5

0923.3314679.0282

x

8118.3

13

900.4714679.03763

x

Substituting the x values into the equations

After Iteration #2

0923.3

9000.4

5000.0

3

2

1

x

x

x

59

Page 60: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Example 2

Iteration #2 absolute relative approximate error

%61.24010014679.0

50000.014679.01a

%889.311007153.3

9000.47153.32a

%874.181008118.3

0923.38118.33a

The maximum absolute relative error after the first iteration is 240.61%

This is much larger than the maximum absolute relative error obtained in iteration #1. Is this a problem?

60

Page 61: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iteration a1 a2 a3

123456

0.500000.146790.742750.946750.991770.99919

100.00240.6180.23621.5464.5391

0.74307

4.90003.71533.16443.02813.00343.0001

100.0031.88917.4084.4996

0.824990.10856

3.09233.81183.97083.99714.00014.0001

67.66218.8764.0042

0.657720.0743830.00101

Gauss-Seidel Method: Example 2

Repeating more iterations, the following values are obtained

%1a %

2a %3a

4

3

1

3

2

1

x

x

x

0001.4

0001.3

99919.0

3

2

1

x

x

xThe solution obtained is close to the exact solution of .

61

Page 62: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel Method: Example 3

Given the system of equations

761373 321 xxx

2835 321 xxx

15312 321 xxx

With an initial guess of

1

0

1

3

2

1

x

x

x

Rewriting the equations

3

13776 321

xxx

5

328 312

xxx

5

3121 213

xxx

62

Page 63: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Iteration a1 A2 a3

123456

21.000−196.15−1995.0−20149

2.0364×105

−2.0579×105

95.238110.71109.83109.90109.89109.89

0.8000014.421

−116.021204.6−12140

1.2272×105

100.0094.453112.43109.63109.92109.89

50.680−462.304718.1−47636

4.8144×105

−4.8653×106

98.027110.96109.80109.90109.89109.89

Gauss-Seidel Method: Example 3

Conducting six iterations, the following values are obtained

%1a %

2a %3a

The values are not converging.

Does this mean that the Gauss-Seidel method cannot be used?

63

Page 64: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodThe Gauss-Seidel Method can still be used

The coefficient matrix is not diagonally dominant

5312

351

1373

A

But this is the same set of equations used in example #2, which did converge.

1373

351

5312

A

If a system of linear equations is not diagonally dominant, check to see if rearranging the equations can form a diagonally dominant matrix.

64

Page 65: Linear Systems – Iterative methods 1.Jacobi Method 2.Gauss-Siedel Method 1

Gauss-Seidel MethodNot every system of equations can be rearranged to have a diagonally dominant coefficient matrix.

Observe the set of equations

3321 xxx

9432 321 xxx

97 321 xxx

Which equation(s) prevents this set of equation from having a diagonally dominant coefficient matrix?

65