Angles between two n-dimensional vectors in Python - Stack Overflow

Angles between two n-dimensional vectors in Python - Stack Overflow

Using numpy (highly recommended), you would do:

u = array([1.,2,3,4]) v = ... c = dot(u,v)/norm(u)/norm(v) # -> cosine of the angle angle = arccos(c) # if you really want the angle

你可能感兴趣的:(overflow)