CITS2401 Computer Analysis & Visualisation

Similar documents
CITS2401 Computer Analysis & Visualisation

(Mathematical Operations with Arrays) Applied Linear Algebra in Geoscience Using MATLAB

MATH.2720 Introduction to Programming with MATLAB Vector and Matrix Algebra

A = 3 B = A 1 1 matrix is the same as a number or scalar, 3 = [3].

A VERY BRIEF LINEAR ALGEBRA REVIEW for MAP 5485 Introduction to Mathematical Biophysics Fall 2010

Linear Algebra review Powers of a diagonalizable matrix Spectral decomposition

Linear Algebra review Powers of a diagonalizable matrix Spectral decomposition

POLI270 - Linear Algebra

Computational Methods CMSC/AMSC/MAPL 460. Eigenvalues and Eigenvectors. Ramani Duraiswami, Dept. of Computer Science

Review of Linear Algebra

Lecture 3 Linear Algebra Background

Chapter 2: Numeric, Cell, and Structure Arrays

Matrix notation. A nm : n m : size of the matrix. m : no of columns, n: no of rows. Row matrix n=1 [b 1, b 2, b 3,. b m ] Column matrix m=1

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

Applied Linear Algebra in Geoscience Using MATLAB

MAC Module 1 Systems of Linear Equations and Matrices I

Linear Algebra and Matrices

Chapter 5. Linear Algebra. A linear (algebraic) equation in. unknowns, x 1, x 2,..., x n, is. an equation of the form

MATRICES. a m,1 a m,n A =

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

Digital Workbook for GRA 6035 Mathematics

Identity Matrix: EDU> eye(3) ans = Matrix of Ones: EDU> ones(2,3) ans =

A matrix is a rectangular array of. objects arranged in rows and columns. The objects are called the entries. is called the size of the matrix, and

Linear System of Equations

Numerical Methods Lecture 2 Simultaneous Equations

Materials engineering Collage \\ Ceramic & construction materials department Numerical Analysis \\Third stage by \\ Dalya Hekmat

Applied Linear Algebra in Geoscience Using MATLAB

Introduction to Matrices

I&C 6N. Computational Linear Algebra

Phys 201. Matrices and Determinants

ENGI 9420 Lecture Notes 2 - Matrix Algebra Page Matrix operations can render the solution of a linear system much more efficient.

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Elementary maths for GMT

Definition of Equality of Matrices. Example 1: Equality of Matrices. Consider the four matrices

Lecture Notes in Linear Algebra

Linear Algebra: Lecture Notes. Dr Rachel Quinlan School of Mathematics, Statistics and Applied Mathematics NUI Galway

Topics. Vectors (column matrices): Vector addition and scalar multiplication The matrix of a linear function y Ax The elements of a matrix A : A ij

+ MATRIX VARIABLES AND TWO DIMENSIONAL ARRAYS

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

A Review of Matrix Analysis

Ma 227 Review for Systems of DEs

Elementary Row Operations on Matrices

Getting Started with Communications Engineering. Rows first, columns second. Remember that. R then C. 1

Linear Algebra V = T = ( 4 3 ).

Properties of Linear Transformations from R n to R m

Finite Mathematics Chapter 2. where a, b, c, d, h, and k are real numbers and neither a and b nor c and d are both zero.

Announcements Wednesday, November 7

MATLAB: Operations. In this tutorial, the reader will learn about how to different matrix and polynomial operations.

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

22.3. Repeated Eigenvalues and Symmetric Matrices. Introduction. Prerequisites. Learning Outcomes

Relationships Between Planes

Linear Algebra Practice Problems

FF505 Computational Science. Matrix Calculus. Marco Chiarandini

Numerical Methods Lecture 2 Simultaneous Equations

Introduction to Matrices

Lecture 12: Solving Systems of Linear Equations by Gaussian Elimination

SOLVING LINEAR SYSTEMS

Stat 159/259: Linear Algebra Notes

Vectors and matrices: matrices (Version 2) This is a very brief summary of my lecture notes.

Homework 1 Elena Davidson (B) (C) (D) (E) (F) (G) (H) (I)

MAC Learning Objectives. Learning Objectives (Cont.) Module 10 System of Equations and Inequalities II

Image Registration Lecture 2: Vectors and Matrices

MAC Module 3 Determinants. Learning Objectives. Upon completing this module, you should be able to:

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 )

Conceptual Questions for Review

CS 246 Review of Linear Algebra 01/17/19

B553 Lecture 5: Matrix Algebra Review

PH1105 Lecture Notes on Linear Algebra.

Linear Algebraic Equations

3 Matrix Algebra. 3.1 Operations on matrices

OR MSc Maths Revision Course

Quiz ) Locate your 1 st order neighbors. 1) Simplify. Name Hometown. Name Hometown. Name Hometown.

Linear Algebra March 16, 2019

Announcements Wednesday, November 7

Lecture 7: Introduction to linear systems

Vector/Matrix operations. *Remember: All parts of HW 1 are due on 1/31 or 2/1

Chapter 8 Linear Algebraic Equations

Graphics (INFOGR), , Block IV, lecture 8 Deb Panja. Today: Matrices. Welcome

Inverting Matrices. 1 Properties of Transpose. 2 Matrix Algebra. P. Danziger 3.2, 3.3

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

Maths for Signals and Systems Linear Algebra for Engineering Applications

M.A.P. Matrix Algebra Procedures. by Mary Donovan, Adrienne Copeland, & Patrick Curry

Linear Algebra, Vectors and Matrices

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

Introduction to Quantitative Techniques for MSc Programmes SCHOOL OF ECONOMICS, MATHEMATICS AND STATISTICS MALET STREET LONDON WC1E 7HX

7.4. The Inverse of a Matrix. Introduction. Prerequisites. Learning Outcomes

Chapter 9: Gaussian Elimination

Chapter 8: Linear Algebraic Equations

Linear System of Equations

GAUSSIAN ELIMINATION AND LU DECOMPOSITION (SUPPLEMENT FOR MA511)

MATH 211 review notes

(Linear equations) Applied Linear Algebra in Geoscience Using MATLAB

0.1 Eigenvalues and Eigenvectors

[ Here 21 is the dot product of (3, 1, 2, 5) with (2, 3, 1, 2), and 31 is the dot product of

Elementary Linear Algebra

TI89 Titanium Exercises - Part 10.

Stage-structured Populations

MATH 423 Linear Algebra II Lecture 33: Diagonalization of normal operators.

Math 22AL Lab #4. 1 Objectives. 2 Header. 0.1 Notes

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

Transcription:

FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 7 Matrix Algebra Material from MATLAB for Engineers, Moore, Chapters 10 Additional material by Peter Kovesi and Wei Liu

Objectives After this lecture you should be able to: Perform the basic operations of matrix algebra Solve simultaneous equations using MATLAB matrix operations Use some of MATLAB s special matrices Use some MATLAB matrix functions

The difference between an array and a matrix Most engineers use the two terms interchangeably The only time you need to be concerned about the difference is when you perform matrix algebra calculations Arrays: Technically an array is an orderly grouping of information Arrays can contain numeric information, but they can also contain character data, symbolic data etc. Matrices: The technical definition of a matrix is a two-dimensional numeric array used in linear algebra Not even all numeric arrays can precisely be called matrices - only those upon which you intend to perform linear transformations meet the strict definition of a matrix.

Matrix Operations and Functions Matrix algebra is used extensively in engineering applications Matrix algebra is different from the array calculations we have performed thus far

Array Operators A.* B multiplies each element in array A times the corresponding element in array B A./B divides each element in array A by the corresponding element in array B A.^B raises each element in array A to the power in the corresponding element of array B A+B adds each element in array A to the corresponding element in array B A-B subtracts each element in array A from the corresponding element in array B

Operators used in Matrix Mathematics Transpose Multiplication Division Exponentiation Left Division Some Matrix Algebra functions Dot products Cross products Inverse Determinants

Transpose In mathematics texts you will often see the transpose indicated with superscript T A T The MATLAB syntax for the transpose is A'

!!!! " # $ $ $ $ % & = 12 11 10 9 8 7 6 5 4 3 2 1 A!!! " # $ $ $ % & = 12 9 6 3 11 8 5 2 10 7 4 1 T A The transpose switches the rows and columns

Using the transpose with complex numbers When used with complex numbers, the transpose operator returns the complex conjugate. The complex conjugate of a+bi is a-bi

Complex Conjugate Complex numbers have a real part, which is a normal number, and an imaginary part which is a number multiplied by i, the square root of -1. Given a complex number a + bi it s complex conjugate is a bi. This number has many of the same algebraic properties as a+ bi. Given a matrix of complex numbers, the conjugate transpose generalizes many of the properties of a complex conjugate.

Dot Products The dot product is sometimes called the scalar product the sum of the results when you multiply two vectors together, element by element. Equivalent statements

Example Calculating the Centre of mass (centre of gravity) Finding the centre of mass of a structure is important in a number of engineering applications The location of the center of mass can be calculated by dividing the system up into small components. xm = x 1 m 1 + x 2 m 2 + x 3 m 3 + etc... ym = y 1 m 1 + y 2 m 2 + y 3 m 3 + etc... zm = z 1 m 1 + z 2 m 2 + z 3 m 3 + etc...

In a rectangular coordinate system x, y, and z are the coordinates of the center of mass m is the total mass of the system x1, x2, and x3 etc are the x coordinates of each system component y1, y2, and y3 etc are the y coordinates of each system component z1, z2, and z3 etc are the z coordinates of each system component m1, m2, and m3 etc are the mass of each system component

Example Calculating the Center of mass 1D two mass example x = x 1 m 1 + x 2 m 2 m where m = m 1 + m 2 x=0 m 1 x=x 1 m 2 x=x 2

In this example We ll find the center of gravity of a small collection of the components used in a complex space vehicle Item x, meters y, meters z meters Mass Bolt 0.1 2 3 3.50 gram screw 1 1 1 1.50 gram nut 1.5 0.2 0.5 0.79 gram bracket 2 2 4 1.75 gram Formulate the problem using a dot product

Input and Output Input Location of each component in an x-y-z coordinate system in meters Mass of each component, in grams Output Location of the centre of mass

Hand Example Find the x coordinate of the centre of mass Item x, meters Mass, gram x * m, gram meters Bolt 0.1 x 3.50 = 0.35 screw 1 x 1.50 = 1.50 nut 1.5 x 0.79 = 1.1850 bracket 2 x 1.75 = 3.5 sum 7.54 6.535

We know that The x coordinate is equal to So x x = 4 x i m i i=1 m Total = =6.535/7.54 = 0.8667 meters 4 x i m i i=1 4 m i i=1 This is a dot product

We could use a plot to evaluate our results z-axis 4 3 2 1 Center of Gravity Center of Gravity This plot was enhanced using the interactive plotting tools 0 2 1 1 2 y-axis 0 0 x-axis

Matrix Multiplication Similar to a dot product Matrix multiplication results in an array where each element is a dot product. In general, the results are found by taking the dot product of each row in matrix A with each column in Matrix B

C i, j = N k=1 A i,k B k, j

Because matrix multiplication is a series of dot products the number of columns in matrix A must equal the number of rows in matrix B For an m x n matrix multiplied by an n x p matrix These dimensions must match m x n n x p The resulting matrix will have these dimensions

Matrix multiplication as a function

We could use matrix multiplication to solve the previous problem (centre of mass) in a single step

Matrix Powers Raising a matrix to a power is equivalent to multiplying it times itself the requisite number of times A 2 is the same as A*A A 3 is the same as A*A*A Raising a matrix to a power requires it to have the same number of rows and columns These dimensions must match n x n n x n The resulting matrix will have these dimensions

Matrix Inverse The inverse of a matrix A is the matrix that when multiplied by A, returns the identity matrix. MATLAB offers two approaches The matrix inverse function inv(a) Raising a matrix to the -1 power A -1

Equivalent approaches to finding the inverse of a matrix A matrix times its inverse is the identity matrix

Not all matrices have an inverse Called Singular Ill-conditioned matrices Attempting to take the inverse of a singular matrix results in an error statement The condition number of a matrix measures how close it is to being singular. The function cond(a) measures how sensitive the system of linear equations represented by the matrix A is to errors.

Determinants Related to the matrix inverse If the determinant is equal to 0, the matrix does not have an inverse The MATLAB function to find a determinant is det(a)

Cross Products sometimes called vector products the result of a cross product is a vector always at right angles (normal) to the plane defined by the two input vectors Othogonality Commonly found in equations of mechanics (e.g. fluid mechanics) and electomagnetics (i.e. Maxwell s equations, Lorentz law)

Consider two vectors A = A x i + Ay j + Az k B = B x i + By j + Bz k The cross product is equal to A B = (A y * B z A z * B y ) i + (A z * B x A x * B z ) j + (A x B y A y B x ) k

Cross Products are Widely Used Cross products find wide use in statics, dynamics, fluid mechanics and electrical engineering problems

Solutions to Systems of Linear Equations 3x +2y z = 10 x +3y +2z = 5 x y z = 1 Three variables and three equations should have a solution. We can solve these systems by subtracting one equation from another until we manage to eliminate all but one variable. This is a time consuming process and can lead to large errors if the matrix has a high condition number.

Using Matrix Nomenclature " $ A = $ $ # 3 2 1 1 3 2 1 1 1 %! ' # ' X = # ' # & " x y z $ " & $ & B = $ & $ % # 10 5 1 % ' ' ' & and AX=B

We can solve this problem using the matrix inverse approach This approach is easy to understand, but its not the most efficient computationally

Matrix left division Matrix left division: A\B is a more efficient alternative. It also has less round off error. A related function are rref(a) for calculating the reduced row echelon form of A. Matrix left division uses Gaussian elimination, which is much more efficient, and less prone to round-off error

Linear Transformations Matrix multiplication can be visualized as a continuous linear transformation of a space.! # # " y 1 y 2 $! & & = # A 11 A 12 # % " A 21 A 22 $! &# &# %" Given a two dimensional space, we can multiply every point in that space by a 2x2 matrix. This maps every point to a new point. Common transformations include rotations about the origin, scaling one or more dimensions, or change of basis. x 1 x 2 $ & & % x y

Eigenvectors Given a linear transformation, Eigenvectors are vectors that are only transformed by a scalar factor.! λ# # " x 1 x 2 $! & & = # A 11 A 12 # % " A 21 A 22 $! &# &# %" x 1 x 2 $ & & % The corresponding scalar factor λ for each Eigenvector is called an Eigenvalue. A non-singular 2x2 matrix will always have two Eigenvectors, although they may be complex vectors, as is the case for rotations.

Examples:

A script to display linear transformations

Examples: