Presentation is loading. Please wait.

Presentation is loading. Please wait.

Linear System Remark: Remark: Remark: Example: Solve:

Similar presentations


Presentation on theme: "Linear System Remark: Remark: Remark: Example: Solve:"— Presentation transcript:

1 Linear System Remark: Remark: Remark: Example: Solve:
We want to solve the following linear system Example: Solve: Remark: (1) has a unique solution A is invertable Remark: A is invertable det(A)=0 Remark: A is invertable

2 Linear System Remark: Remark:
We want to solve the following linear system Remark: A is invertable Rank(A)=n Remark:

3 Linear System 2 classes of methods
We want to solve the following linear system 2 classes of methods Direct Methods Iterative Methods Gaussian Elimination LU, Choleski These methods generate a sequence of approximate solutions

4 Iterative Method Remark:
These methods generate a sequence of approximate solutions Remark:

5 Example Jacobi Method Consider 4x4 case 10 -1 2 0 -1 11 -1 3

6 Jacobi Method K=1 K=2 K=3 K=4 K=5 0.6000 1.0473 0.9326 1.0152 0.9890
x1 x2 x3 X4 K=6 K=7 K=8 K=9 K=10 x1 x2 x3 X4

7 Gauss Seidel Method Note that in the Jacobi iteration one does not use the most recently available information. K=1 K=2 K=3 K=4 K=5 x1 x2 x3 X4

8 Gauss Seidel Method Jacobi iteration for general n:
Gauss-Seidel iteration for general n:

9 Splittings and Convergence
DEF: with eigenvalues spectral radius of A is defined to be DEF: Splitting A large family of iteration

10 Splittings and Convergence
A large family of iteration Diagonal Lower Upper Jacobi: Gauss-Seidel:

11 Splittings and Convergence
A large family of iteration THM:

12 Splittings and Convergence
Example: 10 11 8 -1 -1 Jacobi: U=triu(A,1) L=tril(A,-1) D=diag(diag(A)) eig(inv(M)*N) GS: i i

13 Splittings and Convergence
A large family of iteration Remarks: THM: Proof: (Golub p511)

14 Splittings and Convergence
THM: Proof: (Golub p512) show that all eigenvalues are less than one.

15 Splittings and Convergence
DEF: IF Example: THM:

16 Successive over Relaxation Successive over Relaxation
The Gauss-Seidel iteration is very attractive because of its simplicity. Unfortunately, if the spectral radius is close to one, then convergence is vey slow. One solution for this Successive over Relaxation GS: Jacobi:

17 Successive over Relaxation Successive over Relaxation
Example: Successive over Relaxation

18 Successive over Relaxation Successive over Relaxation
Example: K=1 K=2 K=3 x1 x2 x3 X4

19 MATLAB CODE Ex: Jacobi iteration for general n:
Write a Matlab function for Jacobi Jacobi iteration for general n: function [sol,X]=jacobi(A,b,x0) n=length(b); maxiter=10; x=x0; for k=1:maxiter for i=1:n sum1=0; for j=1:i-1 sum1=sum1+A(i,j)*x(j); end sum2=0; for j=i+1:n sum2=sum2+A(i,j)*x(j); xnew(i)=(b(i)-sum1-sum2)/A(i,i) X(1:n,k)=xnew; x=xnew; sol=xnew;

20 MATLAB CODE Ex: GS iteration for general n:
Write a Matlab function for GS GS iteration for general n: function [sol,X]=gs(A,b,x0) n=length(b); maxiter=10; x=x0; for k=1:maxiter for i=1:n sum1=0; for j=1:i-1 sum1=sum1+A(i,j)*x(j); end sum2=0; for j=i+1:n sum2=sum2+A(i,j)*x(j); x(i)=(b(i)-sum1-sum2)/A(i,i) X(1:n,k)=x; sol=x;

21 Another Look Jacobi: GS: Remark: Given:
We want to improve this approximate: Jacobi: GS:

22 Examples of Splittings
1) Non-symmetric Matrix: symmetric Skew-symmetric 2) Domain Decomposition:


Download ppt "Linear System Remark: Remark: Remark: Example: Solve:"

Similar presentations


Ads by Google