开发者

creating a numpy vector using 3 components

开发者 https://www.devze.com 2022-12-16 09:37 出处:网络
I want to create a vector in numpy using 3 components Vx,开发者_StackOverflow Vy, Vz as sown below. Can anyone help? Thank you

I want to create a vector in numpy using 3 components Vx,开发者_StackOverflow 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)


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]])
0

精彩评论

暂无评论...
验证码 换一张
取 消