Question: Q2: Array Processing (15 points) Given a 9-by-9 matrix of random integers from 0 to 99 : 50] : np.random.seed (1) arr =npr random. randint

 Q2: Array Processing (15 points) Given a 9-by-9 matrix of randomintegers from 0 to 99 : 50] : np.random.seed (1) arr =npr

Q2: Array Processing (15 points) Given a 9-by-9 matrix of random integers from 0 to 99 : 50] : np.random.seed (1) arr =npr random. randint (100, size =(9,9)) arr 50] : array ([[37,12,72,9,75,5,79,64,16] [1,76,71,6,25,50,20,18,84], [11,28,29,14,50,68,87,87,94], [96,86,13,9,7,63,61,22,57], [1,0,60,81,8,88,13,47,72], [30,71,3,70,21,49,57,3,68], [24,43,76,26,52,80,41,82,15], [64,68,25,98,87,7,26,25,22] [9,67,23,27,37,57,83,38,8]]) Q2.1 Observe that each 99 matrix is essentially nine blocks of 33 matrix. Write a Python code to calculate the mean value for each of the 33 matrix. Hint: use array slicing to index each of the 9 sub-block. [1] Q2.2: What is the maximum value in the array? What is the index of the maximum value? II Note: use argmax(). Q2.3: What is the minumum value in the array? What is the index of the minumum value? Note: use argmin() Q2.4 Swap the positions of the maximum data with the minimum data. Print the array to show the result. Hint: you can "flatten" the matrix first, make the swap, then reshape it back to 99

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!