两个向量 x , y ∈ R n x,y \in{\Bbb R}^n x,y∈Rn的内积定义如下:
⟨ x , y ⟩ : = x ⋅ y = ∑ i = 1 n x i y i \langle x,y \rangle := x \cdot y = \sum_{i=1}^n x_i y_i ⟨x,y⟩:=x⋅y=i=1∑nxiyi
即对两个向量执行对应位一一相乘再求和。

如图,经过证明可以得到,即两个向量的内积(内乘)可以计算两个向量的夹角。
A ⃗ ⋅ B ⃗ = ∣ ∣ A ⃗ ∣ ∣ ∣ ∣ B ⃗ ∣ ∣ c o s θ \vec A \cdot \vec B = ||\vec A||||\vec B||cos\theta A⋅B=∣∣A∣∣∣∣B∣∣cosθ
参考资料:
- The Geometry of the Dot and Cross Products
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/221821.html原文链接:https://javaforall.net
