Professional Documents
Culture Documents
Iterative Methods
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 1
Objectives
Understanding the meaning of matrix and vector norms and how they are
computed.
Knowing how to use norms to compute the matrix condition number.
Understanding how the magnitude of the condition number can be used to
estimate the precision of solutions of linear algebraic equations.
Understanding the difference between the Gauss-Seidel and Jacobi methods.
Knowing how to assess diagonal dominance and knowing what it means.
Recognizing how relaxation can be used to improve the convergence of
iterative methods.
Understanding how to solve systems of nonlinear equations with successive
substitution and Newton-Raphson.
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 2
Vector and Matrix Norms
For vector in three-dimensional Euclidean space:
The Euclidean norm of [F] is:
As with the other vector norms, it provides a single value to quantify the “size” of [A].
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 3
Vector and Matrix Norms (cont.)
There are alternatives to Euclidian called p-norms that can be represented generally by:
(Euclidean norm is identical to the 2-norm, )
- Row-sum norm:
- Spectral norm: , where is the largest eigenvalue of .
(Ortega, 1972)
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 4
Matrix Condition Number
Matrix condition number is defined by: 1
For a linear system , it can be shown (Ralston & Rabinowitz, 1978; Gerald & Wheatley,
1989) that:
So, the relative error of the computed solution can be as large as the relative error of the
coefficients of multiplied by the condition number.
For example, if the coefficients of are known to -digit precision (i.e., error ) and if ,
solution will be valid to only digits (error ).
The extent of the ill-conditioning can be quantified by calculating
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 5
Example 11.3
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 6
Example 11.3
=1.833x408=747.86
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 7
Norms and Condition Number in MATLAB
MATLAB has built-in functions to compute both norms and condition numbers:
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 8
Example 11.4
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 9
Example 11.4
=2.231x164.976=368
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 10
Jacobi Iterative Method
It is the simplest iterative method to solve a linear system. Consider a 33 system:
{
𝑎11 𝑥1 + 𝑎12 𝑥 2 +𝑎 13 𝑥 3=𝑏 1
𝑎 2 1 𝑥 1+ 𝑎 2 2 𝑥 2+ 𝑎 23 𝑥 3=𝑏 2
𝑎 3 1 𝑥 1+ 𝑎 3 2 𝑥 2+ 𝑎 3 3 𝑥 3= 𝑏3
We need an initial solution guess , we can start with
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 11
Jacobi Iterative Method (cont.)
In general for a system , solution at iteration is obtained from:
𝑖− 1 𝑛
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥( 𝑗𝑘 −1 ) − ∑ 𝑎 𝑖𝑗 𝑥( 𝑗𝑘 −1 )
𝑥𝑖( 𝑘 ) = 𝑗 =1 𝑗 =𝑖 +1
𝑎𝑖𝑖
The linear system residual at iteration is:
or
For the vectors norm, we can choose = (least restrictive), , or (most restrictive)
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 12
Example 12.1
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 13
Example 12.1
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 14
Gauss-Seidel Iterative Method
In the expression of in Jacobi method, are known at iteration for = to .
𝑖− 1 𝑛
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥 ( 𝑘 −1 )
𝑗 − ∑ 𝑎 𝑖𝑗 𝑥( 𝑗𝑘 −1 )
𝑥𝑖( 𝑘 ) = 𝑗 =1 𝑗 =𝑖 +1
(Jacobi)
𝑎𝑖𝑖
In Gauss-Seidel method, (for = to ) are used at iteration in the expression of , so:
𝑖− 1 𝑛
𝑏𝑖 − ∑ 𝑎 𝑖𝑗 𝑥( 𝑗𝑘) − ∑ 𝑎 𝑖𝑗 𝑥( 𝑗𝑘 −1)
𝑥𝑖( 𝑘 ) = 𝑗 =1 𝑗 =𝑖 +1
(Gauss-Seidel)
𝑎 𝑖𝑖
In other terms, in Gauss-Seidel method, we used the most recent value of . Except for
this difference, Gauss-Seidel method is identical to Jacobi’s.
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 15
Example 12.1
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 17
Convergence and Diagonal Dominance
It can be shown that a sufficient (but not necessary) condition for the convergence of
Gauss-Seidel and Jacobi methods is:
( is said diagonally dominant)
When diagonal dominance increases, Gauss-Seidel and Jacobi methods converge faster.
Diagonal dominance can be increased by rows permutation.
Gauss-Seidel method usually converges faster than Jacobi method, but both methods have
linear convergence, i.e., the required number of iteration is proportional to the system size.
Other methods converge much faster, such as conjugate gradient methods (CG, CGS,
BiCG, BiCGStab), quasi-minimal residual method (QMR), generalized minimal residual
method (GMRES), …
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 18
Relaxation
Relaxation represents a slight modification of the Gauss-Seidel method that is designed
to enhance convergence. At each iteration:
Check “SOR.m”
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 20
Example 12.2
λ 1.2
ε 0.1
Iteration
X1 X2 ε (X1) ε (X2)
0 0 0
1 -3.5964 0.096864 100% 100%
2 -2.41264 0.361594 49% 73%
3 -1.37996 0.556492 75% 35%
4 -0.65192 0.692241 112% 20%
5 -0.14658 0.786372 345% 12%
6 0.203728 0.85162 172% 8%
7 0.446544 0.896846 54% 5%
8 0.614849 0.928195 27% 3%
9 0.731509 0.949923 16% 2%
10 0.81237 0.964984 10% 2%
11 0.868418 0.975423 6% 1%
12 0.907267 0.982659 4% 1%
13 0.934195 0.987675 3% 1%
14 0.95286 0.991151 2% 0%
15 0.965797 0.993561 1% 0%
16 0.974764 0.995231 1% 0%
17 0.98098 0.996389 1% 0%
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 21
Non-Linear Equations Systems
Consider 2 nonlinear equations
with 2 unknowns:
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 22
Non-Linear Systems - Successive Substitution
A simple approach is to use the same strategy that was employed for fixed-point iteration
and the Gauss-Seidel method.
[ ]
𝑓 1 ( 𝑥1 , 𝑥 2 ,… , 𝑥 𝑛 )
(𝑘) (𝑘 ) (𝑘)
Stopping criterion:
𝑟
(𝑘)
= 𝑓 2 ( 𝑥(𝑘)
1 , 𝑥2 , … , 𝑥𝑛 )
(𝑘) (𝑘)
⋮
or
𝑓 𝑛(𝑥 )
(𝑘) (𝑘) (𝑘)
1 ,𝑥 2 ,…, 𝑥 𝑛
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 23
Example 12.3
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 24
Example 12.3
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 25
Non-Linear Systems - Newton-Raphson Method
The previous example illustrates the most serious shortcoming of successive substitution:
Convergence often depends on the manner in which the equations are formulated.
The problem is solved by Newton-Raphson approach. Recall that for single non-linear
equation: 𝑓 (𝑥 )
(𝑘 )
𝑓 ( 𝑥 ) =0 ⇒ 𝑥
( 𝑘+ 1) (𝑘 )
=𝑥 − = 𝐹 ( 𝑥
( 𝑘)
)
𝑓 ′ (𝑥 )
( 𝑘)
[ ]
we define the Jacobian matrix J :
𝜕𝑓1 𝜕𝑓1 𝜕𝑓1
…
𝜕𝑥 1 𝜕𝑥 2 𝜕𝑥 𝑛
𝜕𝑓𝑛 𝜕𝑓𝑛
𝐽= 𝜕 𝑓 2 𝜕𝑓2 𝜕𝑓 2 ¿ …¿ ¿
… 𝜕𝑥 2 𝜕𝑥 𝑛
𝜕𝑥 1 𝜕𝑥 2 𝜕𝑥 𝑛
⋮ ⋮ ¿ ¿
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 26
Non-Linear Systems - Newton-Raphson Method
By analogy to a single variable function, for a system of non-linear equations, Newton-
Raphson method is written as:
[ ]
𝑓 ( 𝑥 ,𝑥 ,…,𝑥 ) 𝑓 ( 𝑥 ,𝑥 ,…,𝑥 ) … 𝑓 ( 𝑥 ,𝑥 ,…,𝑥 )
′ (𝑘) (𝑘) (𝑘) ′ (𝑘) (𝑘) (𝑘) ′ (𝑘) (𝑘) (𝑘)
1,𝑥1 1 2 𝑛 1,𝑥 2 1 2 𝑛 1,𝑥 𝑛 1 2 𝑛
[ 𝐽(𝑘) ]= 𝑓 ′2,𝑥 ( 𝑥(𝑘)1 ,𝑥(𝑘)2 ,…,𝑥(𝑘)𝑛 ) 𝑓 2,𝑥 ( 𝑥1 ,𝑥 2 ,…,𝑥 𝑛 )
′ (𝑘) (𝑘) (𝑘)
… 𝑓 2,𝑥 ( 𝑥1 ,𝑥 2 ,…,𝑥 𝑛 ) 𝑛,𝑥 ( 1 2
′ (𝑘) (𝑘)
2
𝑛 ) ¿ ¿ 𝑛,𝑥 ( 1 2
𝑛
𝑛 )¿
(𝑘) 𝑓 ′ 𝑥(𝑘) ,𝑥 (𝑘) ,…,𝑥(𝑘) … 𝑓 ′ 𝑥 (𝑘) ,𝑥(𝑘) ,…,𝑥(𝑘)
1 2 𝑛
⋮ ⋮ ¿ ¿
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 27
Example 12.4
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 28
Example 12.4
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 29
Example 12.4
03/27/2024 GNE 333 - Engineering Analysis 1 – Part 4 – Linear Systems - Direct Methods 30