Question: python code tion, and transpose We discussed multiplication in class and will only discuss the remaining operations here A matrix is a rectangular block of
python code




tion, and transpose We discussed multiplication in class and will only discuss the remaining operations here A matrix is a rectangular block of objects-usually these are numbers. The shape is denoted by the number of rows first, then the number of columns both being some whole number. In the matrix A below, there are n rows and m columns 1,1 1,2 1,m A= (10) n,1 An,2an,m We describe this as an nx m, saying "An N by M matrix." Although the matrix is a mathematical construct, the array data structure works reasonably well as an implementation. We name the structure A and the position is Ali. j] for aij- As we've said in lecture, most folks rely on numpy for arrays. Unsurprisingly, there are matrix operations available. To help hone our skills, we'll be ininitally implementing these operations. Scalar multiplication takes a number a and matrix A and forms the product aA. If you're unfamiliar with matrices, you'll be happy to know it's much like regular multiplication. In this case, the products are the individual entries time the scalar .an,1 -an,2-.. .an,m A3-1-2 (12) 3A: 9-3-6 (13) Two matrices A, B can be summed provided that they have the same n x m dimensions. An entry in the summed matrix is Aij+Bij- Subtraction follows similarly. All that's left is transpose This is an unusual operation in that it changes the dimensions of the matrix while not affecting the entries themselves. Suppose we have A as n x m matrix. The transpose of this matrix, written t(A is a m xn matrix B such that
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
