vector calculation in numpy


# show vector calculation in numpy function

import numpy as np

# new vec
vec_1 = np.array([1,1,0])
vec_2 = np.array([2,3,1])

# mode of the vec
vec_mode = np.linalg.norm(vec_1)

# dot:a.b=|a|*|b|*cos(theta)
vec_dot = np.dot(vec_1, vec_2)

# cross: a*b = c, |a*b|=|a|*|b|*sin(theta)
vec_cross = np.cross(vec_1, vec_2)

print(' mode for vev_1:', vec_mode, '\n dot:', vec_dot, '\n cross:', vec_cross)