25284_mws_gen_sle_ppt_seidel2
-
Upload
yugandhar-damalla -
Category
Documents
-
view
242 -
download
0
Transcript of 25284_mws_gen_sle_ppt_seidel2
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
1/16
1
Gauss-Siedel Method
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
2/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodAn iterative method.
Basic Procedure:
-Algebraically solveeach linearequation for xi
-Assumean initial guesssolution array
-Solve foreach xi and repeat
-Useabsolute relativeapproximateerroraftereachiterationtocheckiferroris within apre-specifiedtolerance.
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
3/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodWhy?
The Gauss-Seidel Methodallowstheusertocontrol round-offerror.
Elimination methodssuchas Gaussian Elimination and LU
Decomposition arepronetoproneto round-offerror.
Also: Ifthephysicsoftheproblemareunderstood,acloseinitialguesscan bemade,decreasing the numberofiterations needed.
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
4/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodAlgorithm
A setofn equationsandn unknowns:
11313212111... bxaxaxaxa nn !
2323222121... bxaxaxaxa n2n !
nnnnnnn bxaxaxaxa ! ...332211
. .
. .
. .
If: thediagonal elementsare
non-zero
Rewrite eachequation solvingforthecorresponding unknown
ex:
Firstequation,solve for x1
Secondequation,solve for x2
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
5/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodAlgorithm
Rewriting eachequation
11
13132121
1
a
xaxaxacx nn
!
--
nn
nnnnnn
n
nn
nnnnnnnnnn
nn
a
xaxaxacx
a
xaxaxaxacx
a
xaxaxacx
11,2211
1,1
,122,122,111,111
22
23231212
2
!
!
!
--
--
///
--
FromEquation 1
Fromequation 2
Fromequation n-1
Fromequation n
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
6/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodAlgorithm
General Formofeachequation
11
11
11
1a
xac
x
n
jj
jj
{!
!
22
21
22
2a
xac
x
j
n
jj
j
{!
!
1,1
11
,11
1
{!
!
nn
n
njj
jjnn
na
xac
x
nn
n
njj jnjn
na
xac
x{!
!
1
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
7/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodAlgorithm
General Form forany row i
.,,2,1,
1
nia
xac
xii
n
ijj
jiji
i -!
!
{!
How or wherecan thisequation beused?
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
8/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodSolve fortheunknowns
Assumean initial guess for [X]
-
n
-n
2
x
x
x
x
1
1
/
Use rewritten equationstosolve for
each valueof xi.
Important:Remembertousethe
most recent valueof xi.Which
meanstoapply valuescalculatedto
thecalculations remaining in the
current iteration.
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
9/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel MethodCalculatethe AbsoluteRelative ApproximateError
100x
xxnew
i
old
i
new
i
ia v
!I
So when hastheanswerbeen found?
Theiterationsarestopped when theabsolute relative
approximateerroris lessthan aprespecifiedtolerance forall
unknowns.
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
10/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel Method: Example 2Given thesystemofequations
15x-3x12x321!
283x5xx321
!
7613x7x3x321 !
-
!
-
1
0
1
3
2
1
x
x
x
Withan initial guessof
Thecoefficientmatrix is:
? A
-
!
1373
351
5312
A
Will thesolution convergeusing the
Gauss-Siedel method?
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
11/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel Method: Example 2
? A
-
!
1373
351
5312
A
Checking ifthecoefficientmatrix isdiagonally dominant
43155232122
!!u!! aaa
10731313 323133 !!u!! aaa
8531212 131211 !!u!! aaa
Theinequalitiesareall trueandat leastone row isstrictlygreaterthan:
Therefore: Thesolution shouldconvergeusing the Gauss-Siedel Method
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
12/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel Method: Example 2
-
!
-
-
7628
1
1373351
5312
3
2
1
aa
a
Rewriting eachequation
12
531 321
xxx
!
5
328 312
xxx
!
13
7376 213
xxx
!
Withan initial guessof
-
!
-
1
0
1
3
2
1
xx
x
50000.0
12
150311
!
!x
9000.
45
135.028
2!
!
x
0923.3
13
9000.4750000.03763 !
!x
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
13/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel Method: Example 2Theabsolute relativeapproximateerror
%662.6710050000.0
0000.150000.01a
!v
!
%00.1001009000.4
09000.42a
!v
!
%662.671000923.3
0000.10923.33a
!v!
Themaximumabsolute relativeerrorafterthe firstiteration is 100%
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
14/16
http://numericalmethods.eng.usf.edu
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.35
0923.3314679.0282 !
!x
8118.3
13
900.4714679.03763
!
!x
Substituting the x valuesintotheequations After Iteration #2
-
!
-
0923.3
9000.4
5000.0
3
2
1
x
x
x
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
15/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel Method: Example 2Iteration #2 absolute relativeapproximateerror
%62.24010014679.0
50000.014679.01
!v
!a
%887.311007153.3
9000.47153.32
!v
!a
%876.18100
8118.3
0923.38118.33
!v
!a
Themaximumabsolute relativeerrorafterthe firstiteration is 240.62%
Thisismuch largerthan themaximumabsolute relativeerrorobtainedin
iteration #1. Isthisaproblem?
-
8/8/2019 25284_mws_gen_sle_ppt_seidel2
16/16
http://numericalmethods.eng.usf.edu
Gauss-Seidel Method: Example 2Repeating moreiterations,the following valuesareobtained
1aI
2aI
3aI
Iteration a1 a2 a3
1
2
3
4
5
6
0.50000
0.14679
0.74275
0.94675
0.99177
0.99919
67.662
240.62
80.23
21.547
4.5394
0.74260
4.900
3.7153
3.1644
3.0281
3.0034
3.0001
100.00
31.887
17.409
4.5012
0.82240
0.11000
3.0923
3.8118
3.9708
3.9971
4.0001
4.0001
67.662
18.876
4.0042
0.65798
0.07499
0.00000
-
!
-
4
3
1
3
2
1
x
x
x
-
!
-
0001.4
0001.3
99919.0
3
2
1
x
x
xThesolution obtained
isclosetotheexactsolution of