In this python numpy program, we will calculate the inner/dot product of two vectors using NumPy.
Steps to solve the program
- Import the numpy library as np.
- Create two vectors using np.array().
- Calculate the inner/dot product of two vectors using np.dot().
- Print the output.
import numpy as np
x = np.array([5, 3])
y = np.array([7,4])
print("Inner-dot product: ",np.dot(x,y))
Output :
Inner-dot product: 47