Question: 6. Write a function in numpy that takes two arbitrary shape matrices and calculates the product by the outer product method. Make sure it checks

6. Write a function in numpy that takes two arbitrary shape matrices and calculates the product by the outer product method. Make sure it checks whether their shapes are compatible. 7. Calculate the product by using the numpy operator '@' or np.matmul and verify that it equals the output from the functions written above. 8. Verify that a matrix multiplied by a column vector is simply a linear combination of the columns of the matrix. Namely, if the columns of the matrix A are a_1, a_2 .. a_n and the vector x is (X_1.... x_n), then Ax = x_1a_1 + ... + x n a_n. Explain why this is simply the outer product way of multiplying A and X. 9. Now verify that a row vector multiplied by a matrix is simply a linear combination of the rows of the matrix. Explain again that this is just the outer product way of multiplying. 6. Write a function in numpy that takes two arbitrary shape matrices and calculates the product by the outer product method. Make sure it checks whether their shapes are compatible. 7. Calculate the product by using the numpy operator '@' or np.matmul and verify that it equals the output from the functions written above. 8. Verify that a matrix multiplied by a column vector is simply a linear combination of the columns of the matrix. Namely, if the columns of the matrix A are a_1, a_2 .. a_n and the vector x is (X_1.... x_n), then Ax = x_1a_1 + ... + x n a_n. Explain why this is simply the outer product way of multiplying A and X. 9. Now verify that a row vector multiplied by a matrix is simply a linear combination of the rows of the matrix. Explain again that this is just the outer product way of multiplying
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
