MATHEMATICS

Matrices

Date Published:
Last Modified:

Dot Product

Numpy

The dot product of arrays of vectors can be calculated using Numpy with:

import numpy as np
a = np.array([[1, 1, 1], [2, 2, 2]])
b = np.array([[1, 2, 3], [4, 5, 6]])
np.sum(a*b, axis=1)

Projection

The dot product can be used to calculate the projection of a vector onto an axis in 3D space.


Related Content:

Tags:

comments powered by Disqus