* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download General Problem Solving Methodology
Euclidean vector wikipedia , lookup
Exterior algebra wikipedia , lookup
Jordan normal form wikipedia , lookup
Linear least squares (mathematics) wikipedia , lookup
Perron–Frobenius theorem wikipedia , lookup
Covariance and contravariance of vectors wikipedia , lookup
Vector space wikipedia , lookup
Non-negative matrix factorization wikipedia , lookup
Eigenvalues and eigenvectors wikipedia , lookup
Matrix (mathematics) wikipedia , lookup
Determinant wikipedia , lookup
Orthogonal matrix wikipedia , lookup
Singular-value decomposition wikipedia , lookup
Four-vector wikipedia , lookup
Cayley–Hamilton theorem wikipedia , lookup
Matrix calculus wikipedia , lookup
Matrix multiplication wikipedia , lookup
EGR 106 – Week 4 – Math on Arrays Linear algebraic operations: – – Multiplication Division Row/column based operations Rest of chapter 3 Array Multiplication (Linear Algebra) In linear algebra, the matrix expression F = A * B means F(r, c) A(r, k) * B(k, c) k – Entries are dot products of rows of the first matrix with columns of the second = * For example: 2 3 1 4 1 5 2 6 2 * 1 3 * 2 2 * 4 3 * 6 1 * 1 5 * 2 1 * 4 5 * 6 8 26 11 34 Notes: – – The operation is generally not commutative A*B ≠ B*A The number of columns of the 1st must match the number of rows of the 2nd = n by m * n by k k by m For example, here multiplication works both ways, but is not commutative: quite different! And here it doesn’t work at all: Application of Multiplication Application of matrix multiplication: n simultaneous equations in m unknowns (the x’s) a11x1 a21x1 an1 x1 a12 x2 a1m xm b1 a22 x2 a11xm b2 an 2 x1 anm xm bn For example: 2 x1 3 x2 3x3 7 4 x1 2 x2 9 x3 5 6 x1 7 x2 2 x3 1 In matrix form this is with 2 3 3 A 4 2 9 6 7 2 A*x=b x1 x x2 x3 7 b 5 1 a11x1 a21x1 an1 x1 a12 x2 a1m xm b1 a22 x2 a11xm b2 an 2 x1 anm xm bn In general: – – – A is n by m x is m by 1 b is n by 1 A*x=b column vectors (lower case) Usages – finding: – cable tensions in statics fluid flow in piping heat flow in thermodynamics – e.g. – – – – – currents in circuits traffic flow economics R1 v i1 i2 R3 R2 R1 R2 R 2 R2 i1 v * R2 R3 i2 0 Array Division Recall the command eye(n) – This result is the array – multiplication identity matrix I For any array A A*I=I*A=A must be properly sized! Imagine that for square arrays A and B we have A*B=B*A=I then we call them inverses A = B–1 A ^ -1 B = A–1 In Matlab: or inv(A) When does A–1 exist? – A is square – A has a non-zero determinant (det(A)) For example: Solving A * x = b – Assume that A is square and det(A) ≠ 0 – Multiply both sides by A–1 on the left A–1 *A * x = A–1* b =I =x so – x = A–1* b In Matlab, x = A \ b or x = inv(A)*b backwards slash For example: Check your work: General Linear Equation Solving (not in the book!) Problem types: overdetermined – underdetermined Solution methods: – Cramer's method – Gaussian elimination – inverse matrix – others – Solution situations: – – non-singular: one unique solution singular: no solution many solutions MatLab does them all Vector Based Operations Some operations analyze a vector to yield a single value. For example: sums the elements Other operations for a vector A: – – – – – – Minimum: min(A) Maximum: max(A) Median: median(A) Mean or average: mean(A) Standard deviation: std(A) Product of the elements: prod(A) Some operators yield two results: – min and max can yield both the value and its location – default is the first result Some operators yield vector results – – size(A) we’ve already seen sort Or multiple vectors: Finally, when applied to an array, these operators perform their action on columns Unless you instruct it to work on rows! the 2 means “use the 2nd dimension” i.e. spanning the columns Use help to discover how to use these work