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

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

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

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

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

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

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

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

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

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

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

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

Splittings and Convergence
A large family of iteration THM:

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

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

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

Splittings and Convergence
DEF: IF Example: THM:

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:

Successive over Relaxation Successive over Relaxation
Example: Successive over Relaxation

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

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;

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;

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

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