[Numpy-discussion] dot function or dot notation, matrices, arrays?

Alan G Isaac aisaac@american....
Fri Dec 18 19:46:28 CST 2009


On 12/18/2009 7:12 PM, Wayne Watson wrote:
> The point of the scalar product is to produce theta.

As David said, that is just NumPy's `dot`.

>>> a = np.array([0,2])
>>> b = np.array([5,0])
>>> theta = np.arccos(np.dot(a,b)/np.sqrt(np.dot(a,a)*np.dot(b,b)))
>>> theta
1.5707963267948966
>>> theta/np.pi
0.5

hth,
Alan Isaac



More information about the NumPy-Discussion mailing list