Question: Could you answer this question 2? thank you! 1. Explore the roll function from numpy. First, get set up import numpy as np a =np
Could you answer this question 2? thank you!
1. Explore the roll function from numpy. First, get set up import numpy as np a =np . array ( [ [1,2,3],[4,5,6],[7,8,9]], float ) Then, answer this: What do each of the following return? 1.np.roll (a, 1, axis-0) 2. np.roll(a, 1, axis-1) 3. np.roll(a, 1, axis-o) 4. np.roll(a, 1, axis-l) 2. You have a 2D array of potentials called phi. Write the new potential, phiNew, in terms of the old potential, phi, using the appropriate calls to In other words,fl-in the missing bits phiNew .25 *(np.roll(phi, ?) +np.roll (phi, ) + np.roll(phi, ) + np.roll(phi, 22?)) 3. Write the commands that you need to set to boundary values for the array phiNew to the values in Part 1 below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
