7th Edition
c
Ward Cheney/David Kincaid
UT Austin
Engage Learning: Thomson-Brooks/Cole
www.engage.com
www.ma.utexas.edu/CNA/NMC6
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
1 / 48
(1)
is explored.
This alternative approach is often used on enormous problems that
arise in solving partial differential equations numerically.
In that subject, systems having hundreds of thousands of equations
arise routinely.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
2 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
3 / 48
triangle inequality
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
4 / 48
n
X
|xi |
`1 vector norm
i=1
||x||2 =
X
n
xi2
1/2
Euclidean/`2 vector norm
i=1
||x|| =
max |xi |
1in
` vector norm
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
5 / 48
triangular inequality
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
6 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
7 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
8 / 48
||A|| =
max
1jn
max
1in
max
1in
n
X
|aij |
`1 matrix norm
i=1
|max |
n
X
|aij |
` matrix norm
j=1
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th EditionOctober 25,www.ma.utexas.edu/
2011
9 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
10 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
11 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
12 / 48
Then we have
A(x + x) = Ax + Ax = b + b
where
Ax = b
From the original linear system Ax = x and norms, we have
||b|| = ||Ax|| ||A|| ||x||
which gives us
1
||x||
||A||
||b||
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
13 / 48
(A) ||b||
||b||
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
14 / 48
1 21 13
H3 = 12 13 14
1
3
1
4
1
5
We can use the MATLAB commands to generate the matrix and then
to compute both the condition number using the 2-norm and the
determinant of the matrix.
We find the condition number to be
(A) = 524.0568
and the determinant to be
Det(A) = 4.6296 104
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
15 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
16 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
17 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
18 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
19 / 48
(k = 1, 2, . . .)
(2)
To see that this is sensible, suppose that the sequence x(k) does
converge, to a vector x , say.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
20 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
21 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
22 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
23 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
24 / 48
aij xj = bi
(1 i n)
(3)
j=1
Solving the ith equation for the ith unknown term, we obtain an
equation that describes the Jacobi method:
"
#
n
X
(k)
(k1)
xi =
(aij /aii )xj
+ (bi /aii )
(1 i n)
(4)
j=1
j6=i
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
25 / 48
(k)
The components xj
and the corresponding new values xj
be used immediately in their place.
can
(5)
j=1
j>i
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
26 / 48
j=1
j6=i
#,
aij xj
aii
end for
end for
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
27 / 48
(k)
xi
j=1
j>i
(6)
The SOR method with = 1 reduces to the Gauss-Seidel method.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
28 / 48
Jacobi iteration
Example
Let
2
A = 1
0
1
0
3 1 ,
1
2
1
b= 8
5
Carry out a number of iterations of the Jacobi iteration, starting with the
zero initial vector.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
29 / 48
1 (k1)
2 x2
(k)
1 (k1)
3 x1
+ 13 x3
(k)
1 (k1)
2 x2
x1
x2
x3
1
2
(k1)
8
3
5
2
Taking the initial vector to be x(0) = [0, 0, 0]T , we find (with the aid
of a computer program or a programmable calculator) that
x(0) = [0, 0, 0]T
x(1) = [0.5000, 2.6667, 2.5000]T
x(2) = [1.8333, 2.0000, 1.1667]T
..
.
x(21) = [2.0000, 3.0000, 1.0000]T
The actual solution (to four decimal places rounded) is obtained.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
30 / 48
2
Q= 0
0
to be the diagonal of A:
0 0
3 0
0 2
Now
1
2
Q1 = 0
1
3
0 ,
12
Q1 A = 13
1
2
21
13
1
0 21 0
h = Q1 b =
B = I Q1 A = 13 0 31 ,
0
1
2
1
2
8
3
52
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
31 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
32 / 48
Gauss-Seidel iteration
Example
Repeat the preceding example using the Gauss-Seidel iteration.
The idea of the Gauss-Seidel iteration is simply to accelerate the
convergence by incorporating each vector as soon as it has been
computed.
Obviously, it would be more efficient in the Jacobi method to use the
(k)
updated value x1 in the second equation instead of the old value
(k1)
x1
.
(k)
Similarly, x2
(k1)
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
33 / 48
Using the new iterates as soon as they become available, we have the
Gauss-Seidel method:
(k)
1 (k1)
2 x2
(k)
1 (k)
3 x1
+ 13 x3
(k)
1 (k)
2 x2
x1
x2
x3
1
2
(k1)
8
3
5
2
Starting with the initial vector zero, some of the iterates are
x(0) = [0, 0, 0]T
x(1) = [0.5000, 2.8333, 1.0833]T
x(2) = [1.9167, 2.9444, 1.0278]T
..
.
x(9) = [2.0000, 3.0000, 1.0000]T
In this example, the convergence of the Gauss-Seidel method is
approximately twice as fast as that of the Jacobi method.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
34 / 48
2
0 0
3 0
Q = 1
0 1 2
The usual row operations give us
1
0 0
2
Q1 = 16 13 0 ,
1
12
1
6
1
2
12
Q1 A = 0
5
6
1
12
13
5
6
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
35 / 48
0 21 0
L = I Q1 A = 0 16 31 ,
h = Q1 b =
0
1
12
1
6
1
2
17
6
13
12
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
36 / 48
SOR iteration
Example
Repeat the preceding example using the SOR iteration with = 1.1.
Introducing a brelaxation factor into the Gauss-Seidel method, we
have the SOR method:
i
h
(k1)
(k1)
(k)
+ 21 + (1 )x1
x1
= 12 x2
(k)
1 (k)
3 x1
+ 31 x3
(k)
1 (k)
2 x2
x2
x3
(k1)
5
2
8
3
(k1)
+ (1 )x2
(k1)
+ (1 )x3
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
37 / 48
Starting with the initial vector of zeros and with = 1.1, some of the
iterates are
x(0) = [0, 0, 0]T
x(1) = [0.5500, 3.1350, 1.0257]T
x(2) = [2.2193, 3.0574, 0.9658]T
..
.
x(7) = [2.0000, 3.0000, 1.0000]T
In this example, the convergence of the SOR method is faster than
that of the Gauss-Seidel method.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
38 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
39 / 48
20
0 0
11
30
Q = 1 11
0
20
0 1 11
Now
Q1 =
11
20
121
600
1331
12000
0
11
30
121
600
0 ,
11
20
Q1 A =
11
10
11
300
121
6000
11
20
539
600
671
12000
11
30
539
600
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
40 / 48
1
11
10
0
20
11
61
11
L = I Q1 A = 300
600
30
671
61
121
12000
6000
600
h = Q1 b =
11
20
627
200
4103
4000
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
41 / 48
Pseudocode
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
42 / 48
for k = 1 to kmax
yx
for i = 1 to n
sum bi
diag aii
if |diag | < then
output diagonal element too small
return
end if
for j = 1 to n
if j 6= i then
sum sum aij yj
end if
end for
xi sum/diag
end for
output k, x
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
43 / 48
if kx yk < then
output k, x
return
end if
end for
output maximum iterations reached
return
end Jacobi
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
44 / 48
Here, the vector y contains the old iterate values, and the vector x
contains the updated ones.
The values of kmax, , and are set either in a parameter statement
or as global variables.
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
45 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
46 / 48
xi sum/diag
xi xi + (1 )yi
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
47 / 48
c (UT Austin[10pt]
Ward Cheney/David Kincaid
NUMERICAL
Engage Learning:
MATHEMATICS
Thomson-Brooks/Cole
& COMPUTING
www.engage.com[10pt]
7th Edition
October 25, www.ma.utexas.edu/
2011
48 / 48