Date post: | 04-Jun-2018 |
Category: |
Documents |
Upload: | tarek-hassan |
View: | 217 times |
Download: | 0 times |
of 28
8/14/2019 Lecture 11BUE
1/28
ScheduleWeek Date Topic Classification of Topic
1 9 Feb. 2010 Introduction toNumerical Methods
and Type of Errors
Measuring errors, Binary representation,Propagation of errors and Taylor series
2 14 Feb. 2010 Nonlinear Equations Bisection Method
3 21 Feb. 2010 Newton-Raphson Method
4 28 Feb. 2010 Interpolation Lagrange Interpolation
5 7 March 2010 Newton's Divided Difference Method
6 14 March 2010 Differentiation Newton's Forward and BackwardDivided Difference
7 21 March 2010 Regression Least squares
8 28 March 2010 Systems of LinearEquations
Gauss-Jacobi
9 11 April 2010 Gauss- Seidel
10 18 April 2010 Integration Composite Trapezoidal and SimpsonRules
11 25 April 2010 Ordinary DifferentialEquations
Euler's Method
12 2 May 2010 Runge-Kutta 2nd and4th order Method
8/14/2019 Lecture 11BUE
2/28
Gauss-Jacobi
Iterative or approximate methodsprovide an alternative to theelimination methods. The Gauss-Jacobimethod is the most commonly used
iterative method.
The system [A]{X}={B} is reshapedby solving the first equation forx1, the
second equation for x2, and the thirdforx3, and n
th equation forxn.
8/14/2019 Lecture 11BUE
3/28
Gauss-Jacobi Method
Algorithm
A set of nequations and nunknowns:
11313212111 ... bxaxaxaxa nn
2323222121 ... bxaxaxaxa n2n
nnnnnnn bxaxaxaxa ...332211
. .
. .
. .
If: the diagonal elements arenon-zero
Rewrite each equation solvingfor the corresponding unknown
ex:
First equation, solve for x1
Second equation, solve for x2
8/14/2019 Lecture 11BUE
4/28
8/14/2019 Lecture 11BUE
5/28
Gauss-Jacobi 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 themost recent value of xi. Which
means to apply values calculated to
the calculations remaining in the
current iteration.
8/14/2019 Lecture 11BUE
6/28
3
333
2
212
1
111
equations33For
c
zbxadz
b
zcxady
a
zcybdx
Now we can start the solution process by
choosing guesses for the xs. A simple way toobtain initial guesses is to assume that they
are zero. These zeros can be substituted into
x1equation to calculate a newx
0=d
1/a
1.
8/14/2019 Lecture 11BUE
7/28
First iteration
3
333
2
222
1
111
equations33For
c
ybxadz
b
zcxady
a
zcybdx
2
030331
3
020221
1
010111
equations33For
b
ybxadz
c
zcxady
a
zcybdx
Applying the initial guess and solving for x, y,
and z
0
0
0
z
y
x
z
y
x
8/14/2019 Lecture 11BUE
8/28
Gauss-Jacobi Method
Calculate the Absolute Relative Approximate Error
100
newi
old
i
new
i
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.
8/14/2019 Lecture 11BUE
9/28
Convergence Criterion for Gauss-
Jacobi Method The Gauss-Jacobi method has two
fundamental problems as any iterative
method:
It is sometimes nonconvergent, and
If it converges, converges very slowly.
8/14/2019 Lecture 11BUE
10/28
Gauss-Jacobi Method
Why?
The Gauss-Jacobi 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.
8/14/2019 Lecture 11BUE
11/28
Gauss-Jacobi Method: Example 1
The upward velocity of a rocket is given at three different
times
Time Velocity
5 106.8
8 177.2
12 279.2
The velocity data is approximated by a polynomial as:
12.t5,322
1 atatatv
st m/sv
Table 1 Velocity vs. Time data.
8/14/2019 Lecture 11BUE
12/28
Gauss-Jacobi Method: Example 1
3
2
1
3
2
3
2
2
2
1
2
1
1
1
1
v
v
v
a
a
a
tt
tt
tt
3
2
1Using a Matrix template of the form
The system of equations becomes
2.279
2.177
8.106
112144
1864
1525
3
2
1
a
a
a
Initial Guess: Assume an initial guess of
5
2
1
3
2
1
a
a
a
8/14/2019 Lecture 11BUE
13/28
Gauss-Jacobi Method: Example 1Rewriting each equation
2.279
2.177
8.106
112144
1864
1525
3
2
1
a
a
a
25
58.106 321
aaa
8
642.177 312
aaa
1
121442.279 213
aaa
8/14/2019 Lecture 11BUE
14/28
Gauss-Jacobi Method: Example 1
Applying the initial guess and solving for ai
5
2
1
3
2
1
a
a
a 6720.325
)5()2(58.1061
a
525.13
8
51642.1772
a
2.111
1
21211442.2793
a
Initial Guess
8/14/2019 Lecture 11BUE
15/28
Gauss-Jacobi Method: Example 1
%76.721006720.3
0000.16720.31a
x
%212.85100525.13
0000.2525.132a
x
%5.951002.111
0000.52.1113a
x
Finding the absolute relative approximate error
100
new
i
old
i
new
i
ia x
xx At the end of the first iteration
The maximum absolute
relative approximate error is95.5%
2.111
525.136720.3
3
2
1
a
aa
8/14/2019 Lecture 11BUE
16/28
Gauss-Jacobi Method: Example 1
Iteration #2
Using
2.111
525.13
6720.3
3
2
1
a
a
a
881.225
2.111525.1358.106
a1
126.21
8
2.111672.3642.177a2
868.411
1
525.1312672.31442.279a3
from iteration #1
the values of ai are found:
8/14/2019 Lecture 11BUE
17/28
Gauss-Jacobi Method: Example 1
Finding the absolute relative approximate error
%455.227100881.2
6720.3881.21a
x
%02.164100126.21
525.13126.212a
x
%05.127100686.411
2.111868.4113a
x
At the end of the second iteration
868.411
126.21
881.2
3
2
1
a
a
a
The maximum absolute
relative approximate error is
227.455%
8/14/2019 Lecture 11BUE
18/28
Iteration a1 a2 a3
1
23
4
3.6720
-2.8818.2972
-42.545
72.767
227.455134.722
119.502
13.525
21.12644.573
162.67
85.212
164.02147.396
127.403
111.2
-411.868947.576
-1450.47
95.5
127.05143.465
165.329
Gauss-Jacobi Method: Example 1
0857.1
690.19
29048.0
a
a
a
3
2
1
Repeating more iterations, the following values are obtained
%1a
%2a
%3a
Notice The relative errors are not decreasing at any significant rate
Also, the solution is not converging to the true solution of
8/14/2019 Lecture 11BUE
19/28
Gauss-Jacobi Method: PitfallWhat went wrong?
Even though done correctly, the answer is not converging to the
correct answer
This example illustrates a pitfall of the Gauss-Jacobi method: not allsystems 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
ij
j
ijii aa1
n
j
j
ijaa
i
1
iifor all i and
for at least one i
8/14/2019 Lecture 11BUE
20/28
Gauss-Jacobi Method: Pitfall
116123
14345
3481.52
A
Diagonally dominant: The coefficient on the diagonal must be at leastequal 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.
8/14/2019 Lecture 11BUE
21/28
Gauss-Jacobi Method: Example 2Given the system of equations
20238 zyx
zyx 33114
351236 zyx
0
00
z
yx
With an initial guess of
The coefficient matrix is:
1236
1114
238
A
Will the solution converge using the
Gauss-Jacobi method?
8/14/2019 Lecture 11BUE
22/28
Gauss-Jacobi Method: Example 2Checking if the coefficient matrix is diagonally dominant
5141111 232122 aaa
9361212 323133 aaa
52388 131211 aaa
The inequalities are all true and at least one row is strictlygreater than:
Therefore: The solution should converge using the Gauss-Jacobi Method
12361114
238
A
8/14/2019 Lecture 11BUE
23/28
Gauss-Jacobi Method: Example 2
3533
20
zy
x
12361114
238
Rewriting each equation
8
2320 zyx
11433 zxy
12
3635 yxz
With an initial guess of
0
0
0
z
y
x
5.2
12
020320x1
311 00433y1
9166667.2
13
030635z1
8/14/2019 Lecture 11BUE
24/28
Gauss-Jacobi Method: Example 2The absolute relative approximate error
%00.1001005.2
0.05.21
a
%00.1001000.3
0.00.32
a
%100100916666.2
0.0916666.23
a
The maximum absolute relative error after the first iteration is 100%
8/14/2019 Lecture 11BUE
25/28
Gauss-Jacobi Method: Example 2
916666.0
3560606.2
895833.2
2
2
2
z
y
x
After Iteration #1
895833.2
8
9166667.2233202
x
3560606.2
11
9166667.25.24332
y
916666.0
12
335.26352
z
Substituting the values into
the equationsAfter Iteration #2
9166667.2
0000.3
5000.2
1
1
1
z
y
x
111 ,, zyx
8/14/2019 Lecture 11BUE
26/28
Gauss-Jacobi Method: Example 2Iteration #2 absolute relative approximate error
%669055.13100895833.2
50000.2895833.21a
%33119.271003560606.2
0.33560606.22a
%181.218100
916667.0
916667.2916667.03a
The maximum absolute relative error after the second iteration is 218.181%
This is much larger than the maximum absolute relative error obtained in
iteration #1. Is this a problem?
8/14/2019 Lecture 11BUE
27/28
Iteration x y z
1
23
4
5
2.5
2.895833.1543
3.04143
3.01687
100.00
13.66908.1942
3.7110
0.8140
3
2.35602.0303
1.9329
1.9696
100.00
27.331116.041
5.0390
1.8633
2.9166
0.916660.8797
0.83191
0.9127
82.193
218.1814.2014
5.7446
8.8911
Gauss-Jacobi Method: Example 2Repeating more iterations, the following values are obtained%
1a %
2a %
3a
9118312.0
9858987.1
0167424.3
z
y
xThe solution obtained is close to the exact solution of .
9118.0
985.1
0167.3
z
y
x
8/14/2019 Lecture 11BUE
28/28
Gauss-Jacobi MethodThe Gauss-Jacobi 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.