1 / 32

MA/CS 375

MA/CS 375. Fall 2002 Lecture 22. Interlude on Norms. We all know that the “size” of 2 is the same as the size of -2, namely: ||2|| = sqrt(2*2) = 2 ||-2|| = sqrt((-2)*(-2)) = 2 The ||..|| notation is known as the norm function. Norm of A Vector.

Download Presentation

MA/CS 375

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. MA/CS 375 Fall 2002 Lecture 22 MA/CS 375 Fall 2002

  2. Interlude on Norms • We all know that the “size” of 2 is the same as the size of -2, namely: • ||2|| = sqrt(2*2) = 2 • ||-2|| = sqrt((-2)*(-2)) = 2 • The ||..|| notation is known as the norm function. MA/CS 375 Fall 2002

  3. Norm of A Vector • We can generalize the scalar norm to a vector norm, however now there are more choices for a vector : MA/CS 375 Fall 2002

  4. Norm of A Vector • Matlab command: • norm(x,1) • norm(x,2) • norm(x,inf) MA/CS 375 Fall 2002

  5. Norm of A Matrix • We can generalize the vector norm to a matrix norm, however now there are more choices for a matrix : • 1-norm maximum absolute column sum • infinity-norm, maximum absolute row sum MA/CS 375 Fall 2002

  6. Norm of A Matrix • Matlab command: • norm(A,1) • norm(A,2) • norm(A,inf) • norm(A,’fro’) MA/CS 375 Fall 2002

  7. Matrix Norm in Action • Theorem 5: (page 185 van Loan) • If is the stored version of then where and i.e. an error of order ||A||1eps occurs when a real matrix is stored in floating point. MA/CS 375 Fall 2002

  8. Condition Number • Recall that when we asked Matlab to invert a matrix which was almost singular: we got this warning MA/CS 375 Fall 2002

  9. Definition of Condition Number • rcond = 1/(condition number) • We are going to use the 1-norm definition of the condition number given as: MA/CS 375 Fall 2002

  10. What’s With The Condition Number ? • Theorem 6: (page 235 van Loan) • If is non-singular and: In addition if then the stored linear system: is nonsingular and also: MA/CS 375 Fall 2002

  11. In Plain English • The theorem supposes that we can solve the Ax=b problem without making any mistakes except for the stored approximation of A and b then: • If the condition number is small enough, then the difference between the exact answer and the calculated answer will be bounded above by: const*condition#*eps • Matlab value of eps is approximately 1e-16 • So if A has a condition number of 1 then we can expect to solve Ax=b to 16 decimal places at best • If A has a condition number of 1000 then in the worst case we could make an error of 1e-13 • If A has a condition number of 10^16 then we could make O(1) errors MA/CS 375 Fall 2002

  12. cond in Matlab • cond(A,1) will return the 1-norm condition number • cond(A,2) will return the 2-norm condition number MA/CS 375 Fall 2002

  13. Team Exercise • Build • For delta=1,0.1,0.01,…,1e-16 compute: • cond(A,1) • Plot a loglog graph of the • x=delta, y=condition number • Figure out what is going on MA/CS 375 Fall 2002

  14. Team Exercise (theory) MA/CS 375 Fall 2002

  15. Team Exercise (theory) MA/CS 375 Fall 2002

  16. Team Exercise (theory) Pretty big huh  Did your results concur? MA/CS 375 Fall 2002

  17. Team Exercise (theory) Pretty big huh  Remark: remember how when we set delta = 2^(-11) and we could actually get the exact inverse. Well in this case the condition number is a little pessimistic as a guide !. MA/CS 375 Fall 2002

  18. Enough Theory ! MA/CS 375 Fall 2002

  19. Interpolation • Question: • someone gives you a function evaluated at 10 points, how does the the function behave between those 10 points? • Answer: • guesses MA/CS 375 Fall 2002

  20. Interpolation • Question: • someone gives you a function evaluated at 10 points, how does the the function behave between those 10 points? • Answer: • there is no unique answer,but we can make a good guess MA/CS 375 Fall 2002

  21. Polynomial Interpolation • What’s the highest order unique polynomial that you can fit through a function evaluated at 1 point? • That would be a constant function with the same value as the given function value. MA/CS 375 Fall 2002

  22. Polynomial Interpolation • What’s the highest order unique polynomial that you can fit through a function evaluated at 2 points? • That would be a linear function that passes through the two values: MA/CS 375 Fall 2002

  23. LinearInterpolation MA/CS 375 Fall 2002

  24. LinearInterpolation exp(x) Samples Linear fit MA/CS 375 Fall 2002

  25. General Monomial Interpolation • Given N function values at N distinct points then there is one unique polynomial which passes through these N points and has order (N-1) • Guess what – we can figure out the coefficients of this polynomial by solving a system of N equations  MA/CS 375 Fall 2002

  26. 2nd Order Polynomial Fit • we are going to use a 2nd order approximation • let’s make sure that the approximation agrees with the sample at: • x1,x2 and x3 MA/CS 375 Fall 2002

  27. 2nd Order Polynomial Fit • We know: • x1,x2 and x3 • f(x1),f(x2) and f(x3) • We do not know: • a1,a2 and a3 MA/CS 375 Fall 2002

  28. 2nd Order Polynomial Fit • We know: • x1,x2 and x3 • f(x1),f(x2) and f(x3) • We do not know: • a1,a2 and a3 re-written as system MA/CS 375 Fall 2002

  29. Finally A Reason To Solve A System So we can build the following then: a = V\f MA/CS 375 Fall 2002

  30. Expansion Coefficients • Once we have the coefficients a1,a2,a3 then we are able to evaluate the quadratic interpolating polynomial anywhere. MA/CS 375 Fall 2002

  31. Class Exercise • Part 1: • Build a function called vandermonde.m which accepts a vector of x values and a polynomial order P • In the function find N=length of x • Function returns a matrix V which is Nx(P+1) and whose entries are: V(n,m) = (xn)(m-1) • Part 2: • Translate this pseudo-code to Matlab a script: • for N=1:5:20 • build x = set of N points in [-1,1] • build f = exp(x) • build xfine = set of 10N points in [-1,1] • build Vorig = vandermonde(N-1,x) • build Vfine = vandermonde(N-1,xfine) • build Finterp = Vfine*(Vorig\f); • plot x,f and xfine,Finterp on the same graph • end MA/CS 375 Fall 2002

  32. Next Lecture • If you have a digital camera bring it in • If not, bring in some jpeg, gif or tif pictures (make sure they are appropriate) • We will use them to do some multi-dimensional interpolation • Estimates for accuracy of polynomial interpolation MA/CS 375 Fall 2002

More Related