22
Iterative Methods Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University Reference: 1. Applied Numerical Methods with MATLAB for Engineers, Chapter 12 & Teaching material

NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

  • Upload
    buitruc

  • View
    219

  • Download
    0

Embed Size (px)

Citation preview

Page 1: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Iterative Methods

Berlin ChenDepartment of Computer Science & Information Engineering

National Taiwan Normal University

Reference:1. Applied Numerical Methods with MATLAB for Engineers, Chapter 12 & Teaching material

Page 2: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Chapter Objectives

• 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 convergence of iterative methods

• Understanding how to solve systems of nonlinear equations with successive substitution and Newton-Raphson

NM – Berlin Chen 2

[A] {x} = {b}

Page 3: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Gauss-Seidel Method• The Gauss-Seidel method is the most commonly used

iterative method for solving linear algebraic equations [A]{x}={b}

• The method solves each equation in a system for a particular variable, and then uses that value in later equations to solve later variables

• For a 3x3 system with nonzero elements along the diagonal, for example, the jth iteration values are found from the j-1th iteration using:

NM – Berlin Chen 3

x1j b1 a12x2

j1 a13x3j1

a11

x2j b2 a21x1

j a23x3j1

a22

x3j b3 a31x1

j a32x2j

a33

3333232131

2323222121

1313212111

bxaxaxabxaxaxabxaxaxa

Page 4: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Gauss-Seidel Method: Convergence

• The convergence of an iterative method can be calculated by determining the relative percent change of each element in {x}. For example, for the i th element in the j th iteration,

• The method is ended when all elements have converged to a set tolerance

NM – Berlin Chen 4

a,i xij xi

j1

xij 100%

Page 5: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Gauss-Seidel Method: An Example (1/2)

NM – Berlin Chen 5

Example 12.1

Page 6: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Gauss-Seidel Method: An Example (2/2)

NM – Berlin Chen 6

Example 12.1

Page 7: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Tactic of Gauss-Seidel Method

• As each new x value is computed for the Gauss-Seidel method, it is immediately used in the next equation to determine another x value

• Thus, if the solution is converging, the best available estimates will be employed for the Gauss-Seidel method

NM – Berlin Chen 7

Page 8: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Jacobi Iteration

• The Jacobi iteration is similar to the Gauss-Seidel method, except the j-1th information is used to update all variables in the j th iteration:– Gauss-Seidel– Jacobi

NM – Berlin Chen 8

Page 9: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Diagonal Dominance

• The Gauss-Seidel method may diverge, but if the system is diagonally dominant, it will definitely converge

• Diagonal dominance means:

NM – Berlin Chen 9

aii aijj1ji

n

Page 10: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

MATLAB Program

NM – Berlin Chen 10

Page 11: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Relaxation

• To enhance convergence, an iterative program can introduce relaxation where the value at a particular iteration is made up of a combination of the old value and the newly calculated value:

– where is a weighting factor that is assigned a value between 0 and 2

• 0<<1: underrelaxation• =1: no relaxation• 1<≤2: overrelaxation

– The choice of a proper value for is highly problem-specific and is often determined empirically

NM – Berlin Chen 11

xinew xi

new 1 xiold

Page 12: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Gauss-Seidel with Relaxation: An Example (1/3)

NM – Berlin Chen 12

Example 12.2

Page 13: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Gauss-Seidel with Relaxation: An Example (2/3)

NM – Berlin Chen 13

Example 12.2

Page 14: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Gauss-Seidel with Relaxation: An Example (3/3)

NM – Berlin Chen 14

Example 12.2

Page 15: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Nonlinear Systems

• Nonlinear systems can also be solved using the same strategy as the Gauss-Seidel method – Solve each system for one of the unknowns and update each

unknown using information from the previous iteration

• This is called successive substitution

NM – Berlin Chen 15

573

102212

2121

xxx

xxx

Page 16: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Successive Substitution: An Example (1/2)

NM – Berlin Chen 16

Example 12.3

573

102212

2121

xxx

xxx

Page 17: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Successive Substitution: An Example (2/2)

NM – Berlin Chen 17

Example 12.3

1. For successive substitution, convergence often depends on the manner in whichthe equations are formulated

2. Divergence also can occur if the initial guesses are insufficiently close to the truesolution

Page 18: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Newton-Raphson (1/3)

• Nonlinear systems may also be solved using the Newton-Raphson method for multiple variables

• For a two-variable system, the Taylor series approximation and resulting Newton-Raphson equations are:

NM – Berlin Chen 18

2

,2,21,2

1

,2,11,1,21,2

2

,1,21,2

1

,1,11,1,11,1

xf

xxxf

xxff

xf

xxxf

xxff

iii

iiiii

iii

iiiii

0

0

1,2

1,1

i

i

f

f

ii

ii

iii

ii

ii

ii

iii

ii

xxf

xxf

fxxf

xxf

xxf

xxf

fxxf

xxf

,22

,2,1

1

,1,11,2

2

,11,1

1

,1

,22

,1,1

1

,1,11,2

2

,11,1

1

,1

ii

ii

iiiii

xfxfxx

fxfxxxfxf

1

11

) of expansion seriesTaylor order -(first0

:equation singlea ofroot thefor Raphon-Newton 6,Chapter in Recall

Page 19: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Newton-Raphson (2/3)

– After algebraic manipulation

NM – Berlin Chen 19

1

,2

2

,1

2

,2

1

,1

1

,2,1

1

,1,2

,21,2

1

,2

2

,1

2

,2

1

,1

2

,1,2

2

,2,1

,11,1

xf

xf

xf

xf

xf

fxf

fxx

xf

xf

xf

xf

xf

fxf

fxx

iiii

ii

ii

ii

iiii

ii

ii

ii

Referred to as the determinant of the Jacobian of the system

2

,2

1

,2

2

,1

1

,1

xf

xf

xf

xf

Jii

ii

Referred to as the Jacobian of the system

Page 20: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Newton-Raphson (3/3)

• Matrix notion of Newton-Raphson– Also can be generalized to n simultaneous equations

NM – Berlin Chen 20

fJxx

xJfxJ

ii

ii

11

1

Page 21: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

Newton-Raphson: An Example

NM – Berlin Chen 21

0573,

010,

573

10

21

2212212

2121211

21

2212

2121

xxxxxxf

xxxxxf

xxxx

xxx

Example 12.4

Page 22: NM2012S-Lecture12-Iterative Methods.ppt [相容模式]berlin.csie.ntnu.edu.tw/Courses/Numerical Methods/Lectures2012S... · Gauss-Seidel Method • The Gauss-Seidel methodis the most

MATLAB Program

NM – Berlin Chen 22