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
Angles between two n-dimensional vectors in Python - Stack Overflow
|