Reputation: 2419
I want to create a vector in numpy using 3 components Vx, Vy, Vz as sown below. Can anyone help? Thank you
from numpy import cos, sin
Vx = cos(alpha)* cos(beta)
Vy = sin(alpha)*cos(beta)
Vz = sin(beta)
Upvotes: 2
Views: 12087
Reputation: 75275
With NumPy, vectors (and matrices for that matter) are just Python arrays. As in
from numpy import array
myVector = array([Vx, Vy, Vz])
myMatrix = array([[Vx, Vy, Vz], [1,2,3]])
Upvotes: 6