Cross product of two vectors in Python

后端 未结 5 731
盖世英雄少女心
盖世英雄少女心 2021-02-18 13:25

How can I calculate the cross product of two vectors without the use of programming libraries?

E.g given vectors a = (1, 2, 3) and b = (4, 5, 6)

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-18 14:04

    import numpy as np
    a = np.array([1,0,0])  
    b = np.array([0,1,0])  
    #print the result    
    print(np.cross(a,b))
    

提交回复
热议问题