线性代数向量内积
Prerequisite: Linear Algebra | Defining a Vector
Linear algebra is the branch of mathematics concerning linear equations by using vector spaces and through matrices. In other words, a vector is a matrix in n-dimensional space with only one column.
线性代数是使用向量空间和矩阵的线性方程组的数学分支。 换句话说,向量是n维空间中只有一列的矩阵。
In this tutorial, we are going to learn the Dot product of two vectors. The dot product of two vectors is only possible when both have the same dimensions.
在本教程中,我们将学习两个向量的点积 。 两个向量的点积只有在两个向量的尺寸相同时才可能。
Syntax:
句法:
dot_product = Vecotr_1.dot(Vector_2)
This is an inbuilt function for dot product of two vectors.
这是两个向量的点积的内置函数。
使用Python代码查找向量的点积 (Python code to find the dot product of vectors)
# Linear Algebra Learning Sequence
# Dot Product of Vectors
import numpy as np
# Use of np.array() to define an Vector
V = np.array([323,623,823])
print("The Vector A : ",V)
VV = np.array([3,63,78])
print("\nThe Vector B : ",VV)
pro = V.dot(VV)
print("Product of two vectors : ", pro)
Output:
输出:
The Vector A : [323 623 823]
The Vector B : [ 3 63 78]
Product of two vectors : 104412
翻译自: https://www.includehelp.com/python/dot-product-of-vectors.aspx
线性代数向量内积