Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON NEED URGENT HELP Q3: Matrix Calculations - 20 pts The file associated with this question is MatrixCalculations.py. You are given a matrix of numbers

PYTHON NEED URGENT HELPimage text in transcribed

Q3: Matrix Calculations - 20 pts The file associated with this question is MatrixCalculations.py. You are given a matrix of numbers (could be int or float) stored in a list of lists, such as: 9, A = [[14, 8, 5, 17], [9, 1, 0, 14, 6], [3, 4, 5, 10, 11], [2, 13, 3, 1, 15], [10, 16, 11, 11, 3], [14, 8, 4, 9]] 3 7, Part A (5 points): Implement the function rowwise_max(A) such that: A is the list of lists, as exemplified above rowwise_max calculates the maximum of each row, row-by-row. The maximums are placed in a one-dimensional list and returned. For the above example, rowwise_max returns: [17, 14, 11, 15, 16, 14] because max of the first row is 17, max of second row is 14, max of third row is 11, etc. Part B (5 points): Implement the function columnwise_avg(A) such that: A is the list of lists, as exemplified above columnwise_avg calculates the average of each column, column-by-column. The averages are placed in a one-dimensional list and returned. For the above example, columnwise_avg returns: (8.666, 8.333, 5.833, 7.5, 10.166] because average of the first column is 8.666, average of the second column is 8.33, etc. Part C (10 points): Implement the function neighborwise_min(A) such that: A is the list of lists, as exemplified above neighborwise_min returns a matrix of the same size as A, let us denote this returned matrix by B. B[]O) = -2 for the four corners of the matrix (upper left corner, upper right corner, lower left corner, lower right corner) OB[i][j] = -1 for the four edges of the matrix (leftmost column, rightmost column, uppermost row, lowermost row), excluding the four corners o For the inner elements, B[i] is equal to 1 if and only if B[][] is smaller than ALL of its neighbors. Otherwise, B[i]) is equal to 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions