NM2_matrix_s02 - CGN 3421 - Computer Methods Gurley...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 2 Simultaneous Equations page 54 of 67 Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations Matrix operations: Mathcad is designed to be a tool for quick and easy manipulation of matrix forms of data. We’ve seen the matrix before as a 2-D array. That is, many pieces of information are stored under a single name. Differ- ent pieces of information are then retrieved by pointing to different parts of the matrix by row and column indexes. Here we will learn some basic matrix operations: Adding and Subtracting, Transpose, Multipli- cation. Adding matrices Add two matrices together is just the addition of each of their respective elements. If A and B are both matrices of the same dimensions (size), then C := A + B produces C, where the i th row and j th column are just the addition of the elements (numbers) in the i th row and j th column of A and B Given: , and so that the addition is : The Mathcad commands to perform these matrix assignments and the addition are: A := Ctrl-M (choose 2 x 3) 1 3 5 7 9 11 B := Ctrl-M (choose 2 x 3) 2 4 6 8 10 12 C := A + B C = Rule: A, B, and C must all have the same dimensions Transpose Transposing a matrix means swapping rows and columns of a matrix. No matrix dimension restrictions Some examples: 1-D , 1x3 becomes ==> 3x1 ! !" # $%!! & " ’( ) *!+!’ & # - !" . "$! ! !# !% ’" && ! #’% & ! $ # % &
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 2 Simultaneous Equations page 55 of 67 2-D , 2x3 becomes ==> 3x2 In general In Mathcad, The transpose is can be keystroked by Ctrl - 1 (the number one) or you can view the matrix pallet (view -> toolbars -> matrix) and click the symbol B Ctrl-1 = Multiplication Multiplication of matrices is not as simple as addition or subtraction. It is not an element by element mul- tiplication as you might suspect it would be. Rather, matrix multiplication is the result of the dot products of rows in one matrix with columns of another. Consider: C := A * B matrix multiplication gives the i th row and k th column spot in C as the scalar results of the dot product of the i th row in A with the k th column in B. In equation form this looks like: Let’s break this down in a step-by-step example: Step 1: Dot Product (a 1-row matrix times a 1-column matrix) The Dot product is the scalar result of multiplying one row by one column DOT PRODUCT OF ROW AND COLUMN Rule: 1) # of elements in the row and column must be the same 2) must be a row times a column, not a column times a row Step 2: general matrix multiplication is taking a series of dot products each row in pre-matrix by each column in post-matrix " */! (/# 0 $/) 0 "/’ "/! "/% & " $ */! "/’ (/# 0 "/! $/) 0 "/% & "%& , () " $ &% , & $ " #")’ %*($ & ()* #% "* )( ’$ & # %+ , ! %& , 1 " &+ , & ! & 2 34 536789: ;9 < & ’#" 1 ) * $ ’1) #1* "1$ .. $ " && 1x3 3x1 1x1
Background image of page 2
CGN 3421 - Computer Methods Gurley Numerical Methods Lecture 2 Simultaneous Equations page 56 of 67 C(i,k) is the result of the dot product of row i in A with column k in B Matrix Multiplication Rules: 1) The # of columns in the pre-matrix must equal # of rows in post-matrix inner matrix dimensions must agree 2) The result of the multiplication will have the outer dimensions
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

NM2_matrix_s02 - CGN 3421 - Computer Methods Gurley...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online