COMP 116: Introduction to Scientific Programming Lecture 7: Matrices and Linear Systems.

Slides:



Advertisements
Similar presentations
4.1 Introduction to Matrices
Advertisements

Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Maths for Computer Graphics
Solution of Simultaneous Linear Algebraic Equations: Lecture (I)
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 12 System of Linear Equations.
Matrix Operations. Matrix Notation Example Equality of Matrices.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 14 Elimination Methods.
Lecture 7 Sept 19, 11 Goals: two-dimensional arrays (continued) matrix operations circuit analysis using Matlab image processing – simple examples Chapter.
Lecture 6 Sept 15, 09 Goals: two-dimensional arrays matrix operations circuit analysis using Matlab image processing – simple examples.
Basic Mathematics for Portfolio Management. Statistics Variables x, y, z Constants a, b Observations {x n, y n |n=1,…N} Mean.
Part 3 Chapter 8 Linear Algebraic Equations and Matrices PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The.
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
A Fast Introduction inverse matrix1 What is a matrix (One Matrix many matrices) Why do they exist Matrix Terminology Elements Rows Columns Square.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
1 Chapter 3 Matrix Algebra with MATLAB Basic matrix definitions and operations were covered in Chapter 2. We will now consider how these operations are.
1 Chapter 2 Matrices Matrices provide an orderly way of arranging values or functions to enhance the analysis of systems in a systematic manner. Their.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Statistical Analysis Professor Lynne Stokes Department of Statistical Science Lecture 5QF Introduction to Vector and Matrix Operations Needed for the.
259 Lecture 14 Elementary Matrix Theory. 2 Matrix Definition  A matrix is a rectangular array of elements (usually numbers) written in rows and columns.
ECON 1150 Matrix Operations Special Matrices
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Simultaneous Equations By Dr J.P.M. Whitty
Learner’s Guide to MATLAB® Chapter 2 : Working with Arrays.
Fin500J Mathematical Foundations in Finance Topic 1: Matrix Algebra Philip H. Dybvig Reference: Mathematics for Economists, Carl Simon and Lawrence Blume,
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Lecture 28: Mathematical Insight and Engineering.
10.4 Matrix Algebra 1.Matrix Notation 2.Sum/Difference of 2 matrices 3.Scalar multiple 4.Product of 2 matrices 5.Identity Matrix 6.Inverse of a matrix.
Class Opener:. Identifying Matrices Student Check:
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
4.1 Using Matrices Warm-up (IN) Learning Objective: to represent mathematical and real-world data in a matrix and to find sums, differences and scalar.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
Finishing up Chapter 5. Will this code enter the if statement? G=[30,55,10] if G
Linear System of Simultaneous Equations Warm UP First precinct: 6 arrests last week equally divided between felonies and misdemeanors. Second precinct:
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
4.1 An Introduction to Matrices Katie Montella Mod. 6 5/25/07.
Matrices. Matrix - a rectangular array of variables or constants in horizontal rows and vertical columns enclosed in brackets. Element - each value in.
Matrix Algebra Basics Chapter 3 Section 5. Algebra.
Matrix and Matrices. Matrix Notation It is used to represent multiple data Your work company runs two types of shop, whole-sale and retail. Your company.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
10.4 Matrix Algebra. 1. Matrix Notation A matrix is an array of numbers. Definition Definition: The Dimension of a matrix is m x n “m by n” where m =
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices.
An Introduction to Matrix Algebra Math 2240 Appalachian State University Dr. Ginn.
MTH108 Business Math I Lecture 20.
Elementary Matrix Theory
A Fast Introduction What is a matrix (One Matrix many matrices)
Introduction What is a matrix (One Matrix many matrices)
Linear Algebraic Equations and Matrices
Chapter 7 Matrix Mathematics
Linear Algebraic Equations and Matrices
Linear independence and matrix rank
Matrix Operations SpringSemester 2017.
PROGRAMME 4 DETERMINANTS.
7.3 Matrices.
PROGRAMME 4 DETERMINANTS.
4-2 Adding & Subtracting Matrices
Chapter 7: Matrices and Systems of Equations and Inequalities
Lecture 11 Matrices and Linear Algebra with MATLAB
Objectives Multiply two matrices.
Matrices.
[MATRICES ].
Inverse of a Matrix Solving simultaneous equations.
3.6 Multiply Matrices.
1.8 Matrices.
Matrices.
Matrix Operations SpringSemester 2017.
1.8 Matrices.
3.5 Perform Basic Matrix Operations Algebra II.
[MATRICES ].
Presentation transcript:

COMP 116: Introduction to Scientific Programming Lecture 7: Matrices and Linear Systems

Recap exercises Indexing: what does A(3:7,5:end) return? Creating: how do you create this matrix? Statistical functions for matrices: ◦ min, max, sum, mean, std

A gambling game One matrix M Two teams: the house and the gambler Gambler picks a column of M, house picks an element from this column. The gambler wins this amount ◦ How much should the house charge the gambler for playing this game? ◦ How much should the gambler pay for playing this game?

Today Linear systems ◦ Solving simultaneous (linear) equations

Simultaneous equations Solve this set of (math) equations ◦ 5x+7y=17 ◦ 2x+3y=7 Now solve this one ◦ 5x+7y+z+2w=30 ◦ 3x+4y+8z+w=39 ◦ 9x+y+4z+2w=31 ◦ 6x+2y+5z+8w=57

Linear Equations

Solving linear equations Ax=b ◦ A is an m x n matrix  Rows of A correspond to equations  Columns of A correspond to variables ◦ x is a n x 1 matrix (n element column vector) ◦ b is a m x 1 matrix ( m element column) In general if m equals n, then x=(A) -1 b ◦ Or in matlabspeak:  x=inv(A)*b  Matlab shorthand >> x=A\b

Exercise Solve these set of equations in the Matlab way ◦ Convert to Ax=b format ◦ Then x=inv(A)*b Set I ◦ 5x+7y=17 ◦ 2x+3y=7 Set II ◦ 5x+7y+z+2w=30 ◦ 3x+4y+8z+w=39 ◦ 9x+y+4z+2w=31 ◦ 6x+2y+5z+8w=57

Matrix multiplication

Vector multiplication >> [1 2 3]*[4;5;6] ans = 32 >> [1 2 3]*[4 5 6] ??? Error using ==> mtimes Inner matrix dimensions must agree. >> [1 2 3]*[4 5 6]' ans = 32

Matrix-Vector Multiplication

Linear Equations Key idea: Can write a complete linear system in vector notation: Ax=b. Since x is unknown, we need some way to express it in terms of A and b.

Matrix Math Matrix multiplication

Matrix Math Exercise Identity matrix

Matrix Math Inverse >> A*inv(A) ans = >> A\A ans = Inverse needs to exist.

Linear Equations: Solving One line: x = A\b Mathematical formulation MATLAB solution:

Matrix element naming convention a11a12a13a14 a21a22a23a24 a31a32a33a34