这里写目录标题
Dot Product (scalar 的similarity)
a = [ a 1 , a 2 ] b = [ b 1 , b 2 ] a . b = [ a 1 , a 2 ] . [ b 1 , b 2 ] = a 1 b 1 + a 2 b 2 a = [a_1, a_2] \space b = [b_1, b_2] \newline a.b = [a_1, a_2] .[b_1, b_2] = a_1b_1+a_2b_2 a=[a1,a2] b=[b1,b2]a.b=[a1,a2].[b1,b2]=a1b1+a2b2
乘法的顺序和规则与数字的一样
使用的一些情况
a . b = ∣ ∣ a ∣ ∣ ∣ ∣ b ∣ ∣ c o s θ a.b=||a|| \space ||b|| cos\theta a.b=∣∣a∣∣ ∣∣b∣∣cosθ
单个vector与自己做dot product的结果是这个vector的length(也叫做norm 或者 magnitude)的平方
a . a = a 1 2 + a 2 2 = ∣ ∣ a ∣ ∣ 2 a.a ={a_1^2} + {a_ 2^2} = ||a||^2 a.a=a12+a22=∣∣a∣∣2
如果想知道a与b的dot product结果,但不知道具体的vector坐标怎么办?
a . b = ∣ ∣ a ∣ ∣ ∣ ∣ b ∣ ∣ c o s θ a.b=||a||\space ||b|| cos\theta a.b=∣∣a∣∣ ∣∣b∣∣cosθ
cosine 角度为0时,cosine的结果为1正(波峰)。意味a,b vector同处于一个相同方向, a,b的dot product 结果也正。
cosine角度为 π \pi π 时,cosine的结果为-1负(波谷)。意味a,b vector 处于不同的两个方向, a,b的dot product 结果为负。
cosine角度为 π / 2 \pi/2 π/2 时,cosine的结果为0(穿过原点)。意味a,b vector 方向互为垂直, a,b的dot product 结果为0。
根据 Cauchy-Schwarz Inequality, dot product 的结果小于或等于vector 的 length (norm/magnitude)相乘
∣ a . b ∣ < = ∣ ∣ a ∣ ∣ ∣ ∣ b ∣ ∣ |a.b| <= ||a|| \space ||b|| ∣a.b∣<=∣∣a∣∣ ∣∣b∣∣
Dot-product-like(matrix 的similarity)
The projection of b onto a
测量vectors相互运动有多好,类似于vectors之间的similarity,这里要用 “doto-product-like” 测量方式。这个方式返回vector (matrix)而不是一个scalar
a . b a.b a.b : 测量“how well b travels in the direction of a”, 这里是测量“b”以“a” 为目标
(
a
.
b
)
.
a
(a.b).a
(a.b).a: preserving information about the direction
因为研究的是direction和length无关,为了减少length的影响,上述公式被优化(使用normalisation)成:
a
.
b
∣
∣
a
∣
∣
a
∣
∣
a
∣
∣
˙
\frac{a.b}{||a||}\dot \frac{a}{||a||}
∣∣a∣∣a.b∣∣a∣∣a˙
a . b ∣ ∣ a ∣ ∣ a ∣ ∣ a ∣ ∣ ˙ \frac{a.b}{||a||}\dot \frac{a}{||a||} ∣∣a∣∣a.b∣∣a∣∣a˙ = a . b a . a a \frac{a.b}{a.a} a a.aa.ba = P r o j a b Proj_ab Projab
使用的一些情况
用于计算点到线的距离
Cross Product (different)
a = [ a 1 , a 2 , a 3 ] b = [ b 1 , b 2 , b 3 ] a . b = [ a 1 , a 2 , a 3 ] × [ b 1 , b 2 , b 3 ] = [ a a b 3 − a 3 b 2 , a 3 b 1 − a 1 b 3 , a 1 b 2 − a 2 b 1 ] a = [a_1, a_2,a_3] \newline b = [b_1, b_2,b_3] \newline a.b = [a_1, a_2,a_3] \times [b_1, b_2,b_3] =[a_ab_3 - a_3b_2, a_3b_1-a_1b_3,a_1b_2-a_2b_1] a=[a1,a2,a3]b=[b1,b2,b3]a.b=[a1,a2,a3]×[b1,b2,b3]=[aab3−a3b2,a3b1−a1b3,a1b2−a2b1]
- order 很重要: a × b = − ( b × a ) a\times b= - (b \times a) a×b=−(b×a)
- cross product 可以用来计算 orthogonality:
“the more othogonal a and b are, the longer the cross product axb will be” - dot product 用 c o s θ cos \theta cosθ, cross product 用 s i n θ sin \theta sinθ
∣ ∣ a × b ∣ ∣ = ∣ ∣ a ∣ ∣ ∣ ∣ b ∣ ∣ s i n θ ||a \times b||=||a|| \space ||b|| sin \theta ∣∣a×b∣∣=∣∣a∣∣ ∣∣b∣∣sinθ
sine 角度为0, π \pi π 时,sine的结果为0(穿过原点)。意味a,b vector 平行, a,b的cross product 结果为最小。
sine角度为 π / 2 \pi/2 π/2, 3 π / 2 3\pi /2 3π/2 时,sine的结果为1, -1负(波峰,波谷)。意味a,b vector 垂直, a,b的cross product 结果为最大。
Cross Product (Area)
正rectangle比平行四边形更多的面积,所以对于cross product的面积性质,vectors间越垂直,那么面积越大
一个vector不能凑成rectangle ,所以 cross product: a × a = 0 a\times a = 0 a×a=0
Orthogonality (Orthogonality)
a × b a \times b a×b 或 b × a b \times a b×a 都是vector, 这两个vector 与 vector a 或者 vector b都互相垂直
3D
V = (area of base) (vertical height)
V = ∣ ∣ a × b ∣ ∣ ||a \times b|| ∣∣a×b∣∣ ∣ ∣ p r o j a × b c ∣ ∣ ||proj_{a\times b}c|| ∣∣proja×bc∣∣
- 这里的projection里有两个注意点:
- 计算里要使用normalisation (同 dot product 的 projection 操作)
- 这里求的是面积与某个方向的projection,所以要用 cross product: ∣ ∣ p r o j a × b c ∣ ∣ ||proj_{a\times b}c|| ∣∣proja×bc∣∣ 而不是 dot product.