{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

L6_LinEqnIterative

# L6_LinEqnIterative - MA2213 Lecture 6 Linear...

This preview shows pages 1–12. Sign up to view the full content.

MA2213 Lecture 6 Linear Equations (Iterative Solvers)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Many science and engineering applications require solutions of large linear systems 000 , 10 , , = × n R A b x A n n Direct methods, e.g. Gaussian elimination, that produce the exact solution (except for roundoff error) in a fixed number of steps, require excessive computation time and computer memory. Iteration Methods p. 303-305
Such systems are usually solved by iterative methods which produce a sequence of approximations to the solution. Often, the matrix A is very sparse (most entries = 0), and iterative methods are very efficient for sparse matrices. Iteration Methods

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Jacobi Method p.304 1 3 2 1 9 b x x x = + + system This suggest the Jacobi iteration sequence 2 3 2 1 3 10 2 b x x x = + + 3 3 2 1 11 4 3 b x x x = + + ] [ 3 2 1 9 1 1 x x b x - - = ] 3 2 [ 3 1 2 10 1 2 x x b x - - = ] 4 3 [ 2 1 3 11 1 3 x x b x - - = equivalent ] [ ) ( 3 ) ( 2 1 9 1 ) 1 ( 1 k k k x x b x - - = + ] 3 2 [ ) ( 3 ) ( 1 2 10 1 ) 1 ( 2 k k k x x b x - - = + ] 4 3 [ ) ( 2 ) ( 1 3 11 1 ) 1 ( 3 k k k x x b x - - = + for ,... 2 , 1 , 0 = k starting from an initial estimate 0 3 0 2 0 1 , , x x x
MATLAB Code for Jacobi Method function x_final = jacobi_special(x_init,b,num_iter) % function x_final = jacobi_special(x_init,b,num_iter) % % bla bla bla % x(:,1) = x_init; for k = 1:num_iter x(1,k+1) = (1/9)*(b(1)-x(2,k)-x(3,k)); x(2,k+1) = (1/10)*(b(2) - 2*x(1,k) - 3*x(3,k)); x(3,k+1) = (1/11)*(b(3) - 3*x(1,k) - 4*x(2,k)); end x_final = x; >> b = [10 19 0]'; >> x_final = jacobi_special(x_init,b,20)' x_final = 0 0 0 1.1111 1.9000 0 0.9000 1.6778 -0.9939 1.0351 2.0182 -0.8556 0.9819 1.9496 -1.0162 1.0074 2.0085 -0.9768 0.9965 1.9915 -1.0051 1.0015 2.0022 -0.9960 0.9993 1.9985 -1.0012 1.0003 2.0005 -0.9993 0.9999 1.9997 -1.0003 1.0001 2.0001 -0.9999 1.0000 1.9999 -1.0001 1.0000 2.0000 -1.0000 1.0000 2.0000 -1.0000 1.0000 2.0000 -1.0000 First pull down the File menu and choose New m-file or Open an existing m-file, then type and save your program below – I suggest using the same name as the name of the function Always compare your numerical results with results available either in the textbook or elsewhere.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Textbook Results Jacobi Method p. 305 T b ] 0 19 10 [ = For the solution 0232 . 9768 . 0 0085 . 2 0074 . 1 5 0506 . 0162 . 1 9496 . 1 9819 . 0 4 1440 . 8556 . 0182 . 2 0351 . 1 3 3220 . 9939 . 0 6778 . 1 9000 . 0 2 1000 0000 . 0 9000 . 1 1110 . 1 1 2 0 0 0 0 - - - - If T x ] 1 2 1 [ - = T T x x x x ] 0 0 0 [ ] [ ) 0 ( 3 ) 0 ( 2 ) 0 ( 1 ) 0 ( = the Jacobi iteration gives - || || ) ( ) ( 3 ) ( 2 ) ( 1 k k k k x x Error x x x k
Matrix Splitting for Jacobi Method p.306 , U L D A - - = If with D diagonal ; L, U lower, upper triangular, then b D x U L D x 1 1 ) ( - - + + = f + = x B b D U L 1 -1 f ), ( D B - + where

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Jacobi Method If certain conditions on the matrix B hold then the following iteration produces a sequence f + = Bx x ,... 3 , 2 , 1 , 0 , ) ( = k R x n k to n R x that satisfies that converges n R x ) 0 ( initial ‘guess’ stop after a specified number of iterations ) ( ) 1 ( k k x x - + f ) ( ) 1 ( + = + k k x B x Question 1. What is a ‘closed’ formula for ) ( k x Question 2. When will the sequence converge ? or when is sufficiently small
Gauss-Seidel Method p.305 For the same system of equations results from using the new (updated) entries of x as soon as possible This gives the Gauss-Seidel iteration ] [ ) ( 3 ) ( 2 1 9 1 ) 1 ( 1 k k k x x b x - - = + ] 3 2 [ ) ( 3 ) 1 ( 1 2 10 1 ) 1 ( 2 k k k x x b x - - = + + ] 4 3 [ ) 1 ( 2 ) 1 ( 1 3 11 1 ) 1 ( 3 + + + - - = k k k x x b x for ,... 2 , 1 , 0 = k starting from an initial estimate 0 3 0 2 0 1 , , x x x

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Matrix Splitting for Gauss-Seidel p.306 , U L D A - - = If with D diagonal ; L, U lower, upper triangular, then b L D Ux L D x 1 1 ) ( ) ( - - - + - = f + = x G b L D U L D 1 1 ) ( f , ) ( G - - - - where
Gauss-Seidel Method If certain conditions on the matrix G hold

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 34

L6_LinEqnIterative - MA2213 Lecture 6 Linear...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online