Paul Heckbert. Computer Science Department Carnegie Mellon University. 26 Sept B - Introduction to Scientific Computing 1

Similar documents
MATHEMATICS FOR COMPUTER VISION WEEK 2 LINEAR SYSTEMS. Dr Fabio Cuzzolin MSc in Computer Vision Oxford Brookes University Year

Geometric Modeling Summer Semester 2010 Mathematical Tools (1)

Linear Algebraic Equations

Department of Aerospace Engineering AE602 Mathematics for Aerospace Engineers Assignment No. 4

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

CS227-Scientific Computing. Lecture 4: A Crash Course in Linear Algebra

Statistical Geometry Processing Winter Semester 2011/2012

Chapter 9: Gaussian Elimination

Numerical Analysis Fall. Gauss Elimination

Index. book 2009/5/27 page 121. (Page numbers set in bold type indicate the definition of an entry.)

Linear Algebra Massoud Malek

CE 601: Numerical Methods Lecture 7. Course Coordinator: Dr. Suresh A. Kartha, Associate Professor, Department of Civil Engineering, IIT Guwahati.

POLI270 - Linear Algebra

DS-GA 1002 Lecture notes 10 November 23, Linear models

Today s class. Linear Algebraic Equations LU Decomposition. Numerical Methods, Fall 2011 Lecture 8. Prof. Jinbo Bi CSE, UConn

Numerical Methods. Elena loli Piccolomini. Civil Engeneering. piccolom. Metodi Numerici M p. 1/??

Computational Methods. Systems of Linear Equations

Y = ax + b. Numerical Applications Least-squares. Start with Self-test 10-1/459. Linear equation. Error function: E = D 2 = (Y - (ax+b)) 2

Review Questions REVIEW QUESTIONS 71

Singular Value Decompsition

Next topics: Solving systems of linear equations

Review of matrices. Let m, n IN. A rectangle of numbers written like A =

7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix

Maths for Signals and Systems Linear Algebra for Engineering Applications

Scientific Computing

Matrix Operations: Determinant

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

Mobile Robotics 1. A Compact Course on Linear Algebra. Giorgio Grisetti

Chapter Adequacy of Solutions

Study Guide for Linear Algebra Exam 2

Linear Equations in Linear Algebra

nonlinear simultaneous equations of type (1)

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Matrix decompositions

LU Factorization. A m x n matrix A admits an LU factorization if it can be written in the form of A = LU

Example: Current in an Electrical Circuit. Solving Linear Systems:Direct Methods. Linear Systems of Equations. Solving Linear Systems: Direct Methods

MTH 464: Computational Linear Algebra

Matrix decompositions

Solving Consistent Linear Systems

Linear Algebra. Solving SLEs with Matlab. Matrix Inversion. Solving SLE s by Matlab - Inverse. Solving Simultaneous Linear Equations in MATLAB

Solution of Linear Equations

Solving Linear Systems of Equations

Numerical Methods I: Numerical linear algebra

33A Linear Algebra and Applications: Practice Final Exam - Solutions

Practical Linear Algebra: A Geometry Toolbox

Matrix Assembly in FEA

4.2 Floating-Point Numbers

Vector Spaces, Orthogonality, and Linear Least Squares

MATH 2331 Linear Algebra. Section 2.1 Matrix Operations. Definition: A : m n, B : n p. Example: Compute AB, if possible.

L2-7 Some very stylish matrix decompositions for solving Ax = b 10 Oct 2015

LU Factorization. Marco Chiarandini. DM559 Linear and Integer Programming. Department of Mathematics & Computer Science University of Southern Denmark

8. Least squares. ˆ Review of linear equations. ˆ Least squares. ˆ Example: curve-fitting. ˆ Vector norms. ˆ Geometrical intuition

Notes on Solving Linear Least-Squares Problems

MATH 167: APPLIED LINEAR ALGEBRA Chapter 2

MATH 3511 Lecture 1. Solving Linear Systems 1

1 Number Systems and Errors 1

Numerical Methods I Solving Square Linear Systems: GEM and LU factorization

Glossary of Linear Algebra Terms. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Scientific Computing: Dense Linear Systems

Numerical Methods I Non-Square and Sparse Linear Systems

7. Symmetric Matrices and Quadratic Forms

y b where U. matrix inverse A 1 ( L. 1 U 1. L 1 U 13 U 23 U 33 U 13 2 U 12 1

ESSENTIALS OF COMPUTATIONAL LINEAR ALGEBRA Supplement for MSc Optimization 1

B553 Lecture 5: Matrix Algebra Review

Chapter 4. Solving Systems of Equations. Chapter 4

Handout for Adequacy of Solutions Chapter SET ONE The solution to Make a small change in the right hand side vector of the equations

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

1 9/5 Matrices, vectors, and their applications

12/1/2015 LINEAR ALGEBRA PRE-MID ASSIGNMENT ASSIGNED BY: PROF. SULEMAN SUBMITTED BY: M. REHAN ASGHAR BSSE 4 ROLL NO: 15126

MS&E 318 (CME 338) Large-Scale Numerical Optimization

Math 18, Linear Algebra, Lecture C00, Spring 2017 Review and Practice Problems for Final Exam

Lecture 9. Errors in solving Linear Systems. J. Chaudhry (Zeb) Department of Mathematics and Statistics University of New Mexico

4 ORTHOGONALITY ORTHOGONALITY OF THE FOUR SUBSPACES 4.1

Conceptual Questions for Review

Inverses. Stephen Boyd. EE103 Stanford University. October 28, 2017

The SVD-Fundamental Theorem of Linear Algebra

Getting Started with Communications Engineering

9. Numerical linear algebra background

LINEAR SYSTEMS (11) Intensive Computation

Numerical Methods in Matrix Computations

MATH 315 Linear Algebra Homework #1 Assigned: August 20, 2018

Parallel Singular Value Decomposition. Jiaxing Tan

Preliminary/Qualifying Exam in Numerical Analysis (Math 502a) Spring 2012

Elementary maths for GMT

CSE 160 Lecture 13. Numerical Linear Algebra

University of Oxford Department of Engineering Science. A1 Mathematics Linear Algebra. 4 lectures, Michaelmas Term 2010

1 Multiply Eq. E i by λ 0: (λe i ) (E i ) 2 Multiply Eq. E j by λ and add to Eq. E i : (E i + λe j ) (E i )

Exact and Approximate Numbers:

A THEORETICAL INTRODUCTION TO NUMERICAL ANALYSIS

Simultaneous Linear Equations

Cheat Sheet for MATH461

Linear Algebra in Actuarial Science: Slides to the lecture

Matrices and Matrix Algebra.

Review problems for MA 54, Fall 2004.

Linear Algebra review Powers of a diagonalizable matrix Spectral decomposition

Scientific Computing: Solving Linear Systems

Order of convergence. MA3232 Numerical Analysis Week 3 Jack Carl Kiefer ( ) Question: How fast does x n

MH1200 Final 2014/2015

Linear System of Equations

Linear Algebra Math 221

Transcription:

Paul Heckbert Computer Science Department Carnegie Mellon University 26 Sept. 2 5-859B - Introduction to Scientific Computing

aerospace: simulate subsonic & supersonic air flow around full aircraft, no wind tunnel divide space into millions of tetrahedra or parallelepipeds, solve sparse linear or nonlinear PDE nuclear: simulate nuclear eplosion! especially important because of nuclear test bans weather prediction: entire planet, 2 weeks into future astrophysics: galactic collisions automotive: simulate car crash biology: simulate protein folding drug design 26 Sept. 2 5-859B - Introduction to Scientific Computing 2

replace infinite process with finite process e.g. integrals to sums replace general matrices with simple matrices e.g. diagonal replace comple functions with simple ones e.g. polynomials replace nonlinear problems with linear problems replace differential equations with algebraic equations e.g. linear systems replace high-order systems with low-order systems replace infinite-dimensional spaces with finite-dim. ones e.g. all real functions on [,] with samples on n-element grid 26 Sept. 2 5-859B - Introduction to Scientific Computing 3

error type eample: car crash simulation modeling empirical measurements previous computations truncation or discretization rounding approimate car geometry incorrect tire friction coeff. error in initial speed of car numerical solution to dif.eq. used floats, not doubles Each step introduces some error, but magnitudes may differ greatly. Look for the largest source of error the weak link in the chain. 26 Sept. 2 5-859B - Introduction to Scientific Computing 4

(absolute error) = (approimate value) (true value) (absolute error) (approimate value) (relative error) = (true value) = (true value) Fundamental difficulty with measuring error: For many problems we cannot compute the eact answer, we can only approimate it! Often, the best we can do is estimate the error! 26 Sept. 2 5-859B - Introduction to Scientific Computing 5

main() { float f =./3.; printf("%.2f\n", f); // print to 2 digits }.333333343267448 we get 7 significant digits; the rest is junk! When reporting results, only show the significant digits! 26 Sept. 2 5-859B - Introduction to Scientific Computing 6

very widely used standard for floating point C float is 4 bytes: 24 bit mantissa, 8 bit eponent about 7 significant digits smallest pos. no:.3e-38, largest: 3.4e+38 C double is 8 bytes: 53 bit mantissa, bit eponent about 6 significant digits smallest pos.: 2.3e-38, largest:.7e+38 special values Inf - infinity (e.g. /) NaN - not a number, undefined (e.g. /) 26 Sept. 2 5-859B - Introduction to Scientific Computing 7

#include <math.h> main() { int i; float f; double d; } for (i=; i<55; i++) { f =. + pow(.5, i); d =. + pow(.5, i); printf("%2d %.9f %.8f\n", i, f, d); } 26 Sept. 2 5-859B - Introduction to Scientific Computing 8

i float double +2^(-i) 2. 2..5.5 2.25.25 3.25.25 4.625.625 2.477.476837582 22.238.23848579 23.9.9292896 24..59646448 5..9 5..4 52..2 53.. 26 Sept. 2 5-859B - Introduction to Scientific Computing 9

some problems are harder to solve accurately than others The condition number is a measure of how sensitive a problem is to changes in its input ) relative change in output f( ) f( ) / f( ) f ( ) Cond = = = relative change in input f( ) [ ] ) [ ]/ where f ( ) represents the eact solution to problem with input Cond< or so Cond>> problem is well-conditioned problem is ill-conditioned 26 Sept. 2 5-859B - Introduction to Scientific Computing

well conditioned ill-conditioned taking a step on level ground step near cliff tan() near =45, say cos() not near =9 tan() near =9 (because f infinite) cos() near =9 (because f zero) 26 Sept. 2 5-859B - Introduction to Scientific Computing

Solve A=b for A is n n matri and b are n-vectors (column matrices) Later we ll look at overdetermined and underdetermined systems, where the matri is not square (#equations not equal to #unknowns) 26 Sept. 2 5-859B - Introduction to Scientific Computing 2

For a square, n n matri: rank is the ma. no. of linearly independent rows or columns full rank = rank is n rank-deficient = rank is less than n singular matri = determinant zero = no inverse = linearly dependent = rank-deficient = (A= for some nonzero ) 26 Sept. 2 5-859B - Introduction to Scientific Computing 3

26 Sept. 2 5-859B - Introduction to Scientific Computing 4 Rank 2 Rank Rank 4 3 2. 2 2 6 3 2

26 Sept. 2 5-859B - Introduction to Scientific Computing 5 intersection of 2 lines 2 5 2 2 5 2 = = + = y y y y +2y=5 -y=2 a y y a y = = + = 6 3 3 2 3 6 3 2 y +2y=3-3-6y=a a Rank matri means lines are parallel. For most a, lines non-coincident, so no solution. For a=-9, lines coincident, one-dimensional subspace of solutions.

Gaussian Elimination on square matri A A 2 4 2 2 4 2 = 4 9 3 = 2 = 2 3 7 4 LU computes an LU decomposition L is unit lower triangular ( s on diagonal) U is upper triangular 26 Sept. 2 5-859B - Introduction to Scientific Computing 6

G.E. can be done on any square matri if A singular then diagonal of U will contain zero(s) usually partial pivoting is used (swapping rows during elimination) to reduce errors G.E. is an eample of an eplicit method for solving linear systems solve for solution in one sweep Other, more efficient algorithms can be used for specialized matri types, as we ll see later 26 Sept. 2 5-859B - Introduction to Scientific Computing 7

to solve A=b: decompose A into LU -- cost 2n 3 /3 flops solve Ly=b for y by forw. substitution -- cost n 2 flops solve U=y for by back substitution -- cost n 2 flops slower alternative: compute A - -- cost 2n 3 flops multiply =A - b -- cost 2n 2 flops this costs about 3 times as much as LU lesson: if you see A - in a formula, read it as solve a system, not invert a matri 26 Sept. 2 5-859B - Introduction to Scientific Computing 8

Symmetric Positive Definite an important matri class symmetric: A=A T positive definite: T A> for Ø all λ i > if A is spd, LU decomposition can be written A=LL T, where L is lower triangular (not unit) this is the Cholesky factorization no pivoting required -- cost n 3 /3 flops 26 Sept. 2 5-859B - Introduction to Scientific Computing 9

A method for solving n n linear systems What is its cost? 26 Sept. 2 5-859B - Introduction to Scientific Computing 2

2 = n i= n 2 2 = i i= i -norm, Manhattan norm = ma -norm i i 2-norm, Euclidean norm norms differ by at most a constant factor, for fied n n n 2 2 26 Sept. 2 5-859B - Introduction to Scientific Computing 2

matri norm defined in terms of vector norm: A = ma A geometric meaning: the maimum stretch resulting from application of this transformation eact result depends on whether -, 2-, or -norm is used 26 Sept. 2 5-859B - Introduction to Scientific Computing 22

A measure of how close a matri is to singular cond( A) = κ ( A) = A A maimum stretch = = maimum shrink ma i min i λ λ i i cond(i) = cond(singular matri) = 26 Sept. 2 5-859B - Introduction to Scientific Computing 23