gauss seidel method
TRANSCRIPT
http://numericalmethods.eng.usf.edu
Gauss-Seidel 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.
http://numericalmethods.eng.usf.edu
Gauss-Seidel Method
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.
http://numericalmethods.eng.usf.edu
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
http://numericalmethods.eng.usf.edu
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
http://numericalmethods.eng.usf.edu
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
http://numericalmethods.eng.usf.edu
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?
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.
http://numericalmethods.eng.usf.edu
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.
Example: Thermal CoefficientA trunnion of diameter 12.363” has to be cooled from a room temperature of 80°F before it is shrink fit into a steel hub.
The equation that gives the diametric contraction ΔD of the trunnion in dry-ice/alcohol (boiling temperature is −108°F is given by:
108
80
)(363.12 dTTD
Figure 1 Trunnion to be slid through the hub after contracting.
Example: Thermal CoefficientThe expression for the thermal expansion coefficient, is obtained using regression analysis and hence solving the following simultaneous linear equations:
Find the values of a1, a2,and a3 using Gauss-Seidel Method.
56799.2
1004162.1
10057.1
1024357.51086472.11026.7
1086472.11026.72860
1026.72860242
4
3
2
1
1085
85
5
a
a
a
2321 TaTaa
Example: Thermal Coefficient
56799.2
1004162.1
10057.1
1024357.51086472.11026.7
1086472.11026.72860
1026.72860242
4
3
2
1
1085
85
5
a
a
a
The system of equations is:
Initial Guess:
Assume an initial guess of
0
0
0
3
2
1
a
a
a
Example: Thermal Coefficient
56799.2
1004162.1
10057.1
1024357.51086472.11026.7
1086472.11026.72860
1026.72860242
4
3
2
1
1085
85
5
a
a
a
Rewriting each equationIteration 1
654
1 104042424
01026702860100571
...
a
95
862
2 100024310267
0108647211040424286010041621
.
.
...a
1210
9865
3 103269110243575
100024310864721104042410267567992
.
.
.....a
Example: Thermal Coefficient
%100100103269.1
100103269.1
%100100100024.3
1000100024.3
%100100104042.4
0104042.4
100
12
12
3
9
9
2
6
6
1
a
a
a
newi
oldi
newi
ia x
xx
Finding the absolute relative approximate error
At the end of the first iteration
The maximum absolute relative approximate error is 100%.
12
9
6
3
2
1
1032691
1000243
1040424
.
.
.
a
a
a
Example: Thermal CoefficientIteration 2
Using from Iteration 1
the values of ai are found:
12
9
6
3
2
1
1032691
1000243
1040424
.
.
.
a
a
a
6
12594
1
1080214
24
10326911026710002432860100571
.
....a
9
5
12862
2
1022914
10267
1032691108647211080214286010041621
.
.
....a
12
10
9865
3
1047382
10243575
102291410864721108021410267567992
.
.
.....a
Example: Thermal CoefficientFinding the absolute relative approximate error
At the end of the second iteration
The maximum absolute relative approximate error is 46.360%.
%360.46100104738.2
)103269.1(104738.2
%007.291001022911.4
100024.310221.4
%2864.8100108021.4
104042.4108021.4
12
1212
3
9
99
2
6
66
1
a
a
a
12
9
6
3
2
1
1047382
1022914
1080214
.
.
.
a
a
a
Iteration a1 a2 a3
1
2
3
4
5
6
4.4042×10−6
4.8021×10−6
4.9830×10−6
5.0636×10−6
5.0980×10−6
5.1112×10−6
100
8.2864
3.6300
1.5918
0.6749
0.2593
3.0024×10−9
4.2291×10−9
4.6471×10−9
4.7023×10−9
4.6033×10−9
4.4419×10−9
100
29.0073
8.9946
1.1922
2.1696
3.6330
−1.3269×10−12
−2.4738×10−12
−3.4917×10−12
−4.4083×10−12
−5.2399×10−12
−5.9972×10−12
100
46.3605
29.1527
20.7922
15.8702
12.6290
Example: Thermal CoefficientRepeating more iterations, the following values are obtained
%1a %
2a %3a
! Notice – After six iterations, the absolute relative approximate errors are decreasing, but are still high.
Iteration a1 a2 a3
7576
5.0692×10−6
5.0691×10−6
2.2559×10−4
2.0630×10−4
2.0139×10−9
2.0135×10−9
0.024280.02221
−1.4049×10−11
−1.4051×10−11
0.011250.01029
Example: Thermal CoefficientRepeating more iterations, the following values are obtained
%1a %
2a %3a
The value of closely approaches the true value of
11
9
6
3
2
1
1040511
1001352
1006915
.
.
.
a
a
a
11
9
6
3
2
1
1040661
1000872
1006905
.
.
.
a
a
a
Example: Thermal CoefficientThe polynomial that passes through the three data
points is then
2321 TaTaaT
21196 104051.11000135.21006915.5 TT