Matrix journey so far

Hello All

Just wanted to share my matrix + python journey so far and solicit any advice

I had finished the session on “Lists” and was getting ready to do the assignment of finding the power of a square matrix. I had wanted to write a generic matrix multiplication code and use that for this assignment

I realized except for the movie name “Matrix”, I did not remember anything about matrices !

So I started with querying row/col of a give matrix. Realized querying “row” was easier than “column”

After this proceeded to matrix addition of two matrices, with the check that the rows and cols of both the matrices are same before addition

Then decided to start with a generic matrix multiplication code. Looked up the matrix multiplication rules (# col of 1st matrix == # of row 2nd matrix)

Also saw that if I can convert 2nd matrix where the rows and columns are swapped, it can be easier. Later learnt that this called “Transposing” a matrix

So wrote a code to transpose a given matrix

Finally proceeded to multiplication again, where I take the product of first matrix and transpose of second matrix for any dimensions (provided they satisfy the rule for multiplication)

After this solved the given assignment problem using all of the code (transpose/generic matrix multiplication)

In the process learnt that “lists” are not that easy to handle especially initialization etc but definitely learnt a lot on lists

I do not now anything about NumPy etc (yet to learn those topics). Will these operations become easier in the sessions to come ?

Thanks for reading
Harish

1 Like

Yes, there are multiple matrices operations in NumPy, which handle all these basic ones.