Question: Follow the function design recipe to define functions for all of the following Exercises. For each function, create three examples to test your functions. Record

 Follow the function design recipe to define functions for all of

Follow the function design recipe to define functions for all of the following Exercises. For each function, create three examples to test your functions. Record the definitions in the sample script my A4 functions.py Example 1 Write a function matrix multiply(mat 1, mat 2) that replicates the numpy method dot using loops. Your function should take in two numpy arrays and output a numpy array with the same number of rows as mat_1 and the same number of columns as nat 2. - It should use three nested loops, one for the row of the output, one for the column of the output, and one for the sum taken on the multiplication along the elements the corresponding row of mat 1 and column of mat 2. The element in row i and column j of your output array should equal EX_1 mat_1, x mat_2kg, where the number As,t is the clement in rows and columni of the array A. - You can use the command mat_1.dot (mat_2) to produce the output for a test case. - Your function should return None and print a warning message if the matrices are not conformable; that is, if the number of rows of mat_2 is not equal to number of columns of mat_1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!