mag[source]

mag(v)

Finds magnitude of vector

v (np.array): vector

Example from this thread

Using atan2 is more robust for very small angels:

a = 1e-10
u = 4*np.array([1,0,0])
v = np.array([math.cos(a), math.sin(a), 0])*5
math.acos(np.dot(u,v)/(np.linalg.norm(u)*np.linalg.norm(v)))
0.0
math.atan2(np.linalg.norm(np.cross(u,v)),np.dot(u,v))
1e-10

angle[source]

angle(v1, v2)

Finds angel between 2 vectors

returns: ang , v1