1 / 17

Mathematical Modeling

Mathematical Modeling. Team 1 & 7 Presentation : Ji Hoon Lee . Special Linear Systems - Tridiagonal system. Contents. Preliminary - Tridiagonal system solver - The Economical Storage scheme Problem & Result - Compute x for Ax = b by using Tridiagonal system solver

rock
Télécharger la présentation

Mathematical Modeling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mathematical Modeling Team 1 & 7 Presentation : JiHoon Lee Special Linear Systems -Tridiagonal system

  2. Contents Preliminary - Tridiagonal system solver - The Economical Storage scheme Problem & Result - Compute x for Ax = b by using Tridiagonal system solver - Find an economical storage scheme Summary Moreover Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M

  3. Preliminary -Tridiagonal system solver Let T be a tridiagonal matrix When the LU factorization of T exists (T=LU) L and U have very simple structures. Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M • : Algorithm for the LU factorization of T • and L, U

  4. Preliminary After we find L and U with just 2n-2 flops, we can solve Tx = b by solving two special bidiagonal systems Ly = b and Ux = y It needs only 4n-4 flops to compute x This is called Tridiagonal system solver Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M

  5. Preliminary -The Economical Storage scheme Let T be a n by n tridiagonal matrix. Since T is a n by n matrix, we need space to store it. However, if LU factorization of T exists, by storing l2~ln, u1~unand b1~bn-1, We can need just 3n storage space Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M

  6. Problem A is a tridiagonal matrix (from gallery) Choose b so that Ax=b has solution vector x with all elements are 1 For n=50, 100, compute x (use tridiagonal system solver w/o pivoting) 4. Find economical storage scheme (Do not store or operate on entries outside the bands) Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M

  7. Codes Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M Tridiagonal system solver function [x e d_b u l]=tridsol(n) A=gallery('tridiag',n); d_p=diag(A(2:n,1:n-1)); d_m=diag(A); d_b=diag(A,1); u(1)=d_m(1); % d_p : vector of subdiagonal entries of A % d_m : vector of main diagonal entries of A % d_b : vector of superdiagonal entries of A fori=2:n l(i-1)=(d_p(i-1))/u(i-1); u(i)=d_m(i)-l(i-1)*d_b(i-1); if (u(i)==0) ifi==n break; elsedisp('Itcan not be solved by the tridiagonal system solver.') pause end; end; end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% b(1)=d_m(1)+d_b(1); b(n)=d_p(n-1)+d_m(n); for j=2:n-1 b(j)=d_p(j-1)+d_m(j)+d_b(j); end % b=A*x where x=ones(n,1) y(1)=b(1); for k=2:n y(k)=b(k)-l(k-1)*y(k-1); end % L*y=b x(n)=y(n)/u(n); for f=1:n-1 h=n-f; x(h)=(y(h)-d_b(h)*x(h+1))/u(h); end % U*x=y e=norm(ones(n,1)-x'); % error

  8. Codes Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M Original Matrix Loading each entry function T=Ori(d_b,u,l) n=length(u); T = zeros(n); T(1,1)=u(1); fori = 2:n; T(i,i-1) = l(i-1) * u(i-1); T(i,i) = u(i) + l(i-1)*d_b(i-1); T(i-1,i) = d_b(i-1); End function a = sto(d_b,u,l,x,y) if x ==1 if x==y a = u(1); elseif y==x+1 a = d_b(1); else a= 0; end; end; if x>=2 if x==y, a= u(x) + l(x-1)*d_b(x-1); elseif x==y+1 a= l(x-1)*u(x-1); elseif y==x+1 a = d_b(x); else a=0; end; end;

  9. Result (n=50) Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M x = [ 1 1 1 1 1 1 ÿ 1 1 1 1 1 1 ] : 1x50 e = 3.9886e-014 l = [-0.5 -0.6667 -0.75 ÿ -0.9792 -0.9796 -0.98] : 1x49 u = [2 1.5 1.3333 1.25 ÿ 1.0208 1.0204 1.02] : 1x50 d_b = [-1 -1 -1 -1 -1 ÿ -1 -1 -1 -1 -1 -1 -1]: 1x49

  10. Result (n=100) Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M x = [ 1 1 1 1 1 1 ÿ 1 1 1 1 1 1 ] : 1x100 e = 7.7300e-014 l = [-0.5 -0.6667 -0.75 ÿ -0.9898 -0.9899 -0.9900] : 1x99 u = [2 1.5 1.3333 1.25 ÿ 1.0102 1.0101 1.0100] : 1x100 d_b = [-1 -1 -1 -1 -1 ÿ -1 -1 -1 -1 -1 -1 -1]: 1x99

  11. Economical Storage Scheme Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M For a tridiagonal matrix T(n by n matrix), By stroing only d_b, l, u We can store the whole information of T. So we can save about n^2 – 3n storage space. We can load T from d_b, l and u by using a function T=Ori(d_b,u,l) And also T(x,y) by using a function a=sto(d_b,u,l,x,y)

  12. Economical Storage Scheme Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M When n = 50 we need 2500 space for storing T. However by storing d_b, u and l, we need only 148 space. So we can save 2500-148 = 2352 storage space. When n = 100 we need 10,000 space for storing T. However by storing d_b, u and l, we need only 298 space. So we can save 10,000-298 = 9702 storage space. ∴It is economical

  13. Summary Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M Let T is a tridiagonal matrix, and there exists LU factorization. Then we can use tridiagonal system solver to solve Tx = b with 4n-4 flops Furthermore, we can save a lot space of storage -> 3n by storing l2~ln, u1~unand b1~bn-1, instead of T. For a tridiagonal system, tridiagonal system solver is so useful.

  14. Summary Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M Plot of T (n=50) Plot of T2 (n=100) Storing T(or T2) is a waste of storage space

  15. Moreover - 1 Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M However, we can’t use Tridiagonal system solver for all tridiagonal matrices. Counter Example : B is a 6x6 tridiagonal matrix Since u(2) = 0, l(2) = inf => error occurs It can’t be solved with tridiagonal system solver.

  16. Moreover - 2 Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M Condition number of T (n= 50) Condition number of T2 (n=100) Tridiagonal matrix in gallery is insensitive. How about Hillbert matrix?

  17. Thank you Mathematical Modeling : Special Linear Systems – Tridiagonal system M.M

More Related