I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the normalization is:
def vectors(b): b = b/np.sqrt(np.sum(b**2.,axis=0)) b = b/np.linalg.norm(b) z = np.array([0.,0.,1.]) n1 = np.cross(z,b,axis=0) n1 = n1/np.linalg.norm(n1) ## normalize n return [n1] n1 = vectors(A)
How can I make a loop that picks the first column and makes the calculation, then the second column and so on, but I do not know how to make it!. Could you please help me at this point. Thank in advance!!