View the step-by-step solution to:

Question

Please solve using Python & Numpy:


src="/qa/attachment/10700126/" alt="Screen Shot 2019-10-01 at 9.23.23 PM.png" />

Screen Shot 2019-10-01 at 9.23.33 PM.png

Screen Shot 2019-10-01 at 9.23.23 PM.png

. concentrate: (20 points) This function takes a positive odd integer N and a NumPy array a whose
width and height are both a multiple of the integer N. For each NxN block of values in a, concentrate
replaces the center value with the sum of the values in the NxN block and then zeroes the other values. It
returns a.
My initial "picture" for this problem was sweeping all data values for some region into a pile in the center
of the region.
Examples:
>>>CO
array ([ [9, 1, 6],
[9, 3, 5],
[6, 2, 5]])
>>> c0 . sum( )
46
>>>concentrate(c0, 3)
array ([[ 0, 0,
0] ,
[ 0, 46,
0] ,
[ 0, 0, 0]])
>>>C0
array ([[ 0 , 0,
0] ,
[ 0, 46,
0] ,
[ 0, 0,
0]])

Screen Shot 2019-10-01 at 9.23.33 PM.png

Top Answer

View the full answer
Capture.PNG

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question