[10分] Euclidean distance 問題

2007-11-30 9:32 pm
假設我有兩個3D point

P1(x1,y1,z3)
P2(x2,y2,z3)

甘我用euclidean distance計佢地個distance:
sqrt{ (x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2 }

甘既然二次之後再sqaure root係想令到d負數無左,

甘我想問點解唔係甘樣分開sqrt:
sqrt{ (x1-x2)^2 } + sqrt{ (y1-y2)^2 } + sqrt{ (z1-z2)^2 }

而係一次過先sqrt呀?

唔該晒
更新1:

條式正確黎講係一次過sqrt 但係我就想知點解唔係分開sqrt

回答 (1)

2007-12-01 12:00 am
✔ 最佳答案
其實可以分開
只要一個函數滿足以下條件﹐都可以叫做distance function

d(x,y) ≥ 0, and d(x,y) = 0 if and only if x = y. (Distance is positive between two different points, and is zero precisely from a point to itself.)
It is symmetric: d(x,y) = d(y,x). (The distance between x and y is the same in either direction.)
It satisfies the triangle inequality: d(x,z) ≤ d(x,y) + d(y,z). (The distance between two points is the shortest distance along any path).
你寫的這個function
sqrt{ (x1-x2)^2 } + sqrt{ (y1-y2)^2 } + sqrt{ (z1-z2)^2 }
滿足以上三個條件﹐所以是distance function ﹐不過人們不叫它euclidean distance。因為要留給常用的那個[即sqrt{ (x1-x2)^2 + (y1-y2)^2 + (z1-z2)^2 }]
以下是部份常用的distance (你寫的那個即是1-norm distance)




1-階范數
=

圖片參考:http://upload.wikimedia.org/math/8/7/1/871ec2923f11fb6af43901f13970ee2c.png



2-階范數
=

圖片參考:http://upload.wikimedia.org/math/9/9/9/999b7e7c5b79f528cec014fb9b624f7d.png



n-階范數
=

圖片參考:http://upload.wikimedia.org/math/4/4/4/444044eafaa19384ea32fa58e5637356.png



無窮大階范數
=
t 階范數的極限,即 n 趨向無窮大

圖片參考:http://upload.wikimedia.org/math/e/2/5/e25f07b37eab73aa02db180e81b38f11.png





=
max
圖片參考:http://upload.wikimedia.org/math/8/c/f/8cfc29f87548f0f28ba0dad1fad4f758.png


收錄日期: 2021-04-23 00:17:26
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20071130000051KK01154

檢視 Wayback Machine 備份