lec4_jacobi-seidel-relax

Page 1

ITERATIVE METHODS


Basic Procedure: 

Ensure that the system is arranged diagonally dominant.

Algebraically solve each linear equation for xi using an initial guess (if given, otherwise, use 0)

Solve for each xi and repeat

Use absolute relative approximate error after each iteration to check if error is within a pre-specified tolerance; or until 1 of variables’ answer repeats.


Algorithm A set of n equations and n unknowns:

a11 x1 + a12 x2 + a13 x3 + ... + a1n xn = b1 a21 x1 + a22 x2 + a23 x3 + ... + a2n xn = b2 . . .

If: the diagonal elements are non-zero

. . .

an1 x1 + an 2 x2 + an 3 x3 + ... + ann xn = bn

Rewrite each equation solving for the corresponding unknown


Rewriting each equation

x1 =

c1 − a12 x 2 − a13 x3  − a1n x n a11

From Equation 1

c2 − a21 x1 − a23 x3  − a2 n xn a22

From equation 2

x2 =

 xn −1 = xn =

cn −1 − an −1,1 x1 − an −1, 2 x2  − an −1,n − 2 xn − 2 − an −1,n xn

From equation n-1

an −1,n −1

cn − an1 x1 − an 2 x2 −  − an,n −1 xn −1 ann

From equation n


Calculate the Absolute Relative Approximate Error

∈a i =

−x

new i

old i

x

new i

x

×100

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.

5


GAUSS JACOBI METHOD


Consider: 2 x1 −5 x2 +x3 =15 4 x1 −x2 +x3 =7 x1 +2 x2 −10 x3 =36

Re-arrange:

4 x1 −x2 +x3 =7 2 x1 −5 x2 +x3 =15 x1 +2 x2 −10 x3 =36

Working Equations: 7 +x2 −x3 x1 = 4 −15 +2 x1 +x3 x2 = 5 −36 +x1 +2 x2 x3 = 10


Results in tabular form: i

X1

X2

x3

0

0

0

0

1

1.7500

-3.0000

-3.6000

2

1.9000

-3.0200

-4.0250

3

2.0013

-3.0450

-4.0140

4

1.9923

-3.0023

-4.0089

5

2.0017

-3.0049

-4.0012

6

1.9991

-2.9996

-4.0008

7

2.0003

-3.0005

-4.0000

8

1.9999

-2.9999

-4.0001

9

2.0001

-3.0001

-4.0001

Îľ a -


Results in tabular form:

Îľ a

i

X1

X2

x3

0

0

0

0

1

1.7500

-3.0000

-3.6000

-

2

1.9000

-3.0200

-4.0250

-

3

2.0013

-3.0450

-4.0140

-

4

1.9923

-3.0023

-4.0089

-

5

2.0016

-3.0049

-4.0012

-

6

1.9991

-2.9996

-4.0008

-

7

2.0003

-3.0005

-4.0000

-

8

1.9999

-2.9999

-4.0001

-

9

2.0000

-3.0001

-4.0000

-

10

2.0000

-3.0000

-4.0000

-

-


Gauss Siedel Method Uses every current values

•


Results in tabular form:

(x1,x2,x3=0)

i

X1

X2

x3

1

1.7500

-2.3000

-3.8850

2

2.1463

-2.9185

-3.9691

3

2.0127

-2.9887

-3.9965

4

2.0020

-2.9985

-3.9995

5

2.0003

-2.9998

-3.9999

6

2.0000

-3.0000

-4.0000

7

2.0000

-3.0000

-4.0000

Îľ a


Results in tabular form:

(x1,x2,x3=0)

Îľ a

i

X1

X2

x3

1

1.7500

-2.3000

-3.8850

-

2

2.1463

-2.9185

-3.9691

-

3

2.0126

-2.9888

-3.9965

-

4

2.0019

-2.9985

-3.9995

-

5

2.0002

-29998

-3.9999

-

6

2.0000

-3.0000

-4.0000

-

7

2.0000

-3.0000

-4.0000

-


Relaxation Method


Working Equation: 

Rewrite the system in Residual form •

Divide the equation by the negative of the highest coefficient)

For the iterations:  

Select the highest |Rn| Xnew= highest Rn + Xn


Consider: 3 x1 −2 x2 −9 x3 =5 5 x1 +x2 −3 x3 =2 3 x1 +7 x2 −3 x3 =−13

Re-arrange: 5 x1 +x2 −3 x3 =2 3 x1 +7 x2 −3 x3 =−13 3 x1 −2 x2 −9 x3 =5

Working Equations: −x1 −0.2 x2 +0.6 x3 +0.4 =R1 −0.4286 x1 −x2 +0.4286 x3 −1.8571 =R2 0.3333 x1 −0.2222 x2 −x3 −0.5556 =R3


Results in tabular form:

(x1,x2,x3=0)

X1

R1

X2

R2

x3

R3

0

0.4000

0

-1.8571

0

-0.5556

0

0.7714

-1.8571

0

0

-0.1430

0.7714

0

-1.8571

-0.3306

0

0.1142

0.7714

0.0661

-2.1877

0

0

0.1876

0.7714

0.1787

-2.1877

0.0804

0.1876

0

Îľ a


Results in tabular form:

(x1,x2,x3=0)

Îľ a

X1

R1

X2

R2

x3

R3

0

0.4000

0

-1.8571

0

-0.5556

0.7714

-1.8571

0

-0.1430

-

-0.3306

0.1142

-

0

0.1876

-

0

-

0.0596

-

0

-

0.7714

0 0.0661

0.9501

0.9859

-2.1877

0.1787

0.0804

0

0.0038

0.0358

0.0293

0

0.0140

0.0119

-

0

0.0088

-

0

-

0

-0.0008

-

-0.0008

-0.0003

-

0

-0.0001

-

0

-

-0.0028

-2.1737

0.0024 0.0017 0.9876

-2.1699

0 0.0001

0.9877

0.0038

0

-2.1707

0

0.1876

-

0.2472

0.2560

0.2559


Next Topic: SOLUTIONS TO NON-LINEAR EQUATIONS


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.