L6_LinEqnIterative - MA2213 Lecture 6 Linear Equations...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MA2213 Lecture 6 Linear Equations (Iterative Solvers) 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 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 , = k starting from an initial estimate 3 2 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 1.1111 1.9000 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. Textbook Results Jacobi Method p. 305 T b ] 19 10 [ = For the solution 0232 . 9768 . 0085 . 2 0074 . 1 5 0506 . 0162 . 1 9496 . 1 9819 . 4 1440 . 8556 . 0182 . 2 0351 . 1 3 3220 . 9939 . 6778 . 1 9000 . 2 1000 0000 . 9000 . 1 1110 . 1 1 2---- If T x ] 1 2 1 [- = T T x x x x ] [ ] [ ) ( 3 ) ( 2 ) ( 1 ) ( = 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 Jacobi Method If certain conditions on the matrix B hold then the following iteration produces a sequence f + = Bx x ,... 3 , 2 , 1 , , ) ( = k R x n k to n R x that satisfies that converges n R x ) ( initial guess stop after a specified number of iterations...
View Full Document

This note was uploaded on 01/06/2012 for the course MA 2213 taught by Professor Michael during the Fall '07 term at National University of Singapore.

Page1 / 34

L6_LinEqnIterative - MA2213 Lecture 6 Linear Equations...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online