tags:

views:

220

answers:

2

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)
+1  A: 
from numpy import *
v = array( [Vx, Vy, Vz] )
Yin Zhu
+2  A: 

With NumPy, vectors (and matrices for that matter) are just Python arrays. As in

myVector = array([Vx, Vy, Vz])
myMatrix = array([[Vx, Vy, Vz], [1,2,3]])
mjv