CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3:...
Transcript of CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3:...
![Page 1: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/1.jpg)
CS 357: Numerical Methods
Lecture 3: Matrices and Vector Norms
Eric Shaffer
Adapted from the slides of Phillip Klein
![Page 2: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/2.jpg)
Matrices
![Page 3: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/3.jpg)
![Page 4: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/4.jpg)
Transpose
![Page 5: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/5.jpg)
Matrices are Vectors
![Page 6: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/6.jpg)
Null Space
![Page 7: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/7.jpg)
![Page 8: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/8.jpg)
Solution Space
![Page 9: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/9.jpg)
![Page 10: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/10.jpg)
![Page 11: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/11.jpg)
Gaussian Elimination Review Solving Systems by Hand
![Page 12: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/12.jpg)
Non-Triangular Example
![Page 13: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/13.jpg)
Non-Triangular Example
![Page 14: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/14.jpg)
3 by 3 Example
![Page 15: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/15.jpg)
3 by 3 Example
![Page 16: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/16.jpg)
3 by 3 Example
![Page 17: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/17.jpg)
Finding an Inverse via Gaussian Elimination
¤ Append the identity matrix to the given matrix
![Page 18: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/18.jpg)
Finding an Inverse via Gaussian Elimination
¤ Transform the Left Hand Side (LHS) to transform it to the identity matrix
![Page 19: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/19.jpg)
Barycentric Coordinates for Triangles
¤ Describe location of point in a triangle in relation to the vertices
¤ p=(λ1,λ2 ,λ3) where the following are true ¤ p=λ1a + λ2 b +λ3c
¤ λ1+λ2 +λ3= 1
p
a
b c
![Page 20: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/20.jpg)
Digression: Barycentric Coordinates
¤ Grab some code…. http://courses.engr.illinois.edu/cs519/CS357/barycentric.py
¤ Questions: ¤ What kind of combination are barycentric coordinates
¤ What kind of combination are the “inside” points
¤ Any ideas about what applications barycentric coordinates might have?
![Page 21: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/21.jpg)
Barycentric Coordinates for Triangles
p
a
b c
Acap Abap
Acbp
Coordinates are the signed area of the opposite subtriangle divided by area of the triangle
![Page 22: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/22.jpg)
Barycentric Coordinates for Triangles
![Page 23: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/23.jpg)
Point in Triangle Test for Production Rendering
![Page 24: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/24.jpg)
Interpolating Functions on Triangles
¤ To interpolate a function sampled at the vertices we just do:
f(p)=λ1f(a) + λ2 f(b) +λ3f(c) inside the triangle…..
![Page 25: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/25.jpg)
Vector Norms…
Vector norms are functions that map a vector to a real number You can think of it as measuring the magnitude of the vector The norm you know is the 2-norm: You can use it to measure the distance between two points
![Page 26: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/26.jpg)
Vector Norms…
Vector norms are functions that map a vector to a real number You can think of it as measuring the magnitude of the vector The norm you know is the 2-norm: You can use it to measure the distance between two points Compute a vector v = p2-p1 and take the norm of v
v2= v2i∑
v = v0,v1,...,vd−1
![Page 27: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/27.jpg)
Vector Norms…
Vector norms are functions that map a vector to a real number You can think of it as measuring the magnitude of the vector
![Page 28: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/28.jpg)
Vector Norms…some properties
Triangle Inequality
![Page 29: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/29.jpg)
Visualizing 1-ball of Norms
Where does the norm equal 1 in the 2D Euclidean plane
![Page 30: CS 357: Numerical Methods Lecture 3: Matrices and Vector …...CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein](https://reader036.fdocuments.net/reader036/viewer/2022081601/611656f6e9d60e4fe3440d4b/html5/thumbnails/30.jpg)
Matrix Norms