Top Banner
CS 357: Numerical Methods Lecture 3: Matrices and Vector Norms Eric Shaffer Adapted from the slides of Phillip Klein
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

Mar 14, 2021

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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

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

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
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

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

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

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
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

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
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
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Matrix Norms