I have two N dimensional array, the dimension of both arrays are same. a = (n,n,52) b = (n,n,52) I am trying to filter each of (n,n) array in variable a with (n,n) array in variable b. I am trying this using command b[a==0 | a>5] = 1 But I am getting following error IndexError: ..
I have a function of 5 variables. I would like to visualize how the function behaves by plotting a surface where I span the range of 2 variables and hold the remaining 3 constant. In my case, the function is Black Scholes and it is a function of S,T,K,r,s: BS(S,T,K,r,s) And I would like to ..
Given a multidimensional vector, say for example the 5D vector: (0.33, 0.48, 0.56, 0.486, 0.33), how to write a code in Python to compute an orthogonal vector to this one. Source: Python..
I have generated the output using pandas. But, the same need to be implemented using numpy. The purpose to use numpy is it have more dynamic. Can any one please help me on implementing in numpy. I have read the excel file and converted in to array using df = np.array(df) Need to remove the ..
I have defined a 3-Dimensional matrix like this: vmatriz=np.zeros((n, len(x), len(y))) , where x and y are lists. Now, I have tried to access its elements as follows: for i in range(n): for o in range(len(x)): for p in range(len(y)): dis = math.sqrt((randomobjecti)**2 + (randomobjectop)**2) vmatriz[i][o][j] = constant*dis But I get this error: vmatriz[i][o][j] = ..
I’m trying to plot combinations of 3D slices from nD data (see .gif). The data represents concentration of a particular element and the slider allows one to browse different combinations of 7 elements present in the data set. Currently I am using plotly and python to make these plots. Each scatter plot on the slider ..
As I am new in python and in programming in general, my teacher gave me some work. Some of it is to work with the MNIST database of handwritten numbers. Each of the numbers is a vector of 728 components. The problem comes when I want to compute the centroid of each class. This is, ..