cppb
cppb

Reputation: 2419

creating a numpy vector using 3 components

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

Answers (1)

mjv
mjv

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

Related Questions